*I do have some experience with SQL...enough to get by for basic tasks and simple stored procedures, etc*I have a piece of software that logs data to a database every second.We use several different levels of detail when viewing the data (ie: 1 hour, 6 hour, 12 hour ---> 1 year)Of course, putting 30 million or so data points into a chart is not really needed for the year time frame.I need to figure out some way to select data from every 5 seconds or every 30 seconds, etc... as required by the time frame.Timestamps are used for keys - I am using My SQL 5.1 and the table creation statement follows. There is not much room for changing the table layout --- the software that writes to this table also creates it and if it is changed just recreates it.All help and suggestions are much appreciated.Thanks in advance,JustinDROP TABLE IF EXISTS `clscada`.`sk00trend`;CREATE TABLE `clscada`.`sk00trend` ( `Time_Stamp` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `Time_Stamp_ms` int(11) NOT NULL DEFAULT '0', `ReturnRateWater` double DEFAULT NULL, `LPGasRate` double DEFAULT NULL, `SC_MODA_CH6` double DEFAULT NULL, `SC_MODA_CH7` double DEFAULT NULL, `ReturnRateAll` double DEFAULT NULL, `ReturnRateOil` double DEFAULT NULL, `ReturnStatic` double DEFAULT NULL, `Bias` int(11) NOT NULL DEFAULT '0', `HPGasRate` double DEFAULT NULL, `HPGasStatic` double DEFAULT NULL, `LPGasStatic` double DEFAULT NULL, `TND_SK00_SC_MODA_CH4` double DEFAULT NULL, PRIMARY KEY (`Time_Stamp`,`Time_Stamp_ms`,`Bias`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 PACK_KEYS=1;