Query from command line

Hi all

Firstly, Merry Christmas all!

Now, I’m trying to query my database from the command line to return results from the last hour.

I’m using InfluxDB 1.8.3 on a Raspberry Pi running dietPi.

The command I’m running is either

influx -precision rfc3339 -format csv -database airpressure -execute “SELECT “bathroomhumid” FROM “airpressure” WHERE time > now() - 1h”

Or from influx run interactive:

SELECT “bathroomhumid” FROM “airpressure” WHERE time > now() - 1h

But no results are being returned. What am I doing wrong? There is definitely data under that measurement, but even trying - 24h doesn’t show it.

Hello @gazzat5,
Can you please try running SHOW MEASUREMENTS to verify that you have data under that measurement?
If you see it listed,
Can you then please try SELECT * FROM <MyMeasurement> LIMIT 2? maybe something odd is happening with the timestamps.

Let me know what happens? Thanks

Hi Anaisdg,

I found my mistake. I should have been using the measurements in the from field as per the API. Been a while since I’ve used SQL so I forgot the format was for from to be the table not the database!

(Bathroomhumid is a measurement :wink: )

Thanks for your help & happy new year!