SQL Command Help


Recommended Posts

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

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

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.