ljames28 Posted February 13, 2006 Share Posted February 13, 2006 I want to use an SQL command whereby instead of selecting all the data from a DB, i only select the data fitting a certain criteria. I log temps to a DB every 15 minutes, but i wan't the graph to instead of showing all the data for today, show just half of it. So like it only shows the values taken on the house and on the half hour. sql = "SELECT ctime,reading FROM light WHERE cdate='" & tempDate & "' and sensor='" & tempSensor2 & "' ORDER BY ctime;" '" That command selects all the readings for today for a specific sensor. How can i alter it to suit my needs? Thanks, Law Link to comment Share on other sites More sharing options...
blik Posted February 13, 2006 Share Posted February 13, 2006 Not too sure, but this may work SELECT ctime,reading FROM light WHERE cdate='" & tempDate & "' and sensor='" & tempSensor2 & "' ORDER BY ctime LIMIT 0, count(*)/2; Link to comment Share on other sites More sharing options...
ljames28 Posted February 13, 2006 Author Share Posted February 13, 2006 That didn't work but int he end i used the following command which also works ok. sql = "SELECT ctime,reading FROM temperature WHERE sensor='" & tempSensor3 & "' and cdate BETWEEN '" & date1 & "' AND '" & date2 & "' AND (ctime LIKE '" & ctime1 & "' OR ctime LIKE '" & ctime2 & "' OR ctime LIKE '" & ctime3 & "') ORDER BY cdate,ctime;" Link to comment Share on other sites More sharing options...
Recommended Posts