Why is this not working
...
) as Data
WHERE UNIX_TIMESTAMP(Data.DateTime) <= UNIX_TIMESTAMP(SELECT DateTime from mytable WHERE ID = $inputID)
It seems to work if I don’t have this embedded sql statement, but the sql statement works on its own also so I’m not sure why the combination is causing a failure.
It’s telling me
check to your MySQL server version for the right syntax to use near
‘SELECT DateTime from mytable WHERE ID = 1008)’ at line 1
Try surrounding the SQL with additional parens ():