SQL-problem
Posted: Thursday 05 January 2023 12:47
I use this query in a dzVents script of late Waaren ( viewtopic.php?t=30725 )
collects.meters = 'SELECT a.ID Meter, a.Name Name, b.Value Value, b.Usage Usage, b.Date Date '..
' FROM DeviceStatus a , Meter b WHERE AND a.ID = b.DeviceRowID AND a.ID IN (' .. allMeters .. ')'
of course this is OK.
Now I modified to limit to output using:
collects.meters = 'SELECT a.ID Meter, a.Name Name, b.Value Value, b.Usage Usage, b.Date Date '..
' FROM DeviceStatus a , Meter b WHERE time(b.Date) = "07:00:01" AND a.ID = b.DeviceRowID AND a.ID IN (' .. allMeters .. ')'
note extended where-clause : time(b.Date) = "07:00:01" AND
But ....
When I create the query in DB Browser for SQLite it's OK. Output as expected.
Same query in Domoticz scripts: no output. Logfile shows ERROR ==>> but no errormessage.
Anyone who knows how to solve?
Thanks.
-Bart
collects.meters = 'SELECT a.ID Meter, a.Name Name, b.Value Value, b.Usage Usage, b.Date Date '..
' FROM DeviceStatus a , Meter b WHERE AND a.ID = b.DeviceRowID AND a.ID IN (' .. allMeters .. ')'
of course this is OK.
Now I modified to limit to output using:
collects.meters = 'SELECT a.ID Meter, a.Name Name, b.Value Value, b.Usage Usage, b.Date Date '..
' FROM DeviceStatus a , Meter b WHERE time(b.Date) = "07:00:01" AND a.ID = b.DeviceRowID AND a.ID IN (' .. allMeters .. ')'
note extended where-clause : time(b.Date) = "07:00:01" AND
But ....
When I create the query in DB Browser for SQLite it's OK. Output as expected.
Same query in Domoticz scripts: no output. Logfile shows ERROR ==>> but no errormessage.
Anyone who knows how to solve?
Thanks.
-Bart