Hi, I want to display a list of new messages from a user's chat page.
At the moment, my code is: SELECT Message FROM <tableid> WHERE TargetUser = <currentuser> AND TimeStamp = (from between the time when the user last opened the page and now).
Is there any way to calculate this?
I have saved the time when the user exited the page into a variable and the time when the user opened it again into a different one.
I just want to know how to get all the messages where the target user is the current one and the timestamp is from between the time when the user last opened the page and now.
--
According to the SQL Reference at https://developers.google. com/fusiontables/docs/v2/sql- reference
--
you will need an extra filter clause on the timestamp column
to set the lower bound.
You don't need an upper bound, because you want to see everything till now.
Save the timestamp in TinyDB (tag = "LastTimeStamp") after each message, for future reference next time you start this app.
See the SQL Reference for the special formats recognized for timestamp comparison.
Filtering on
DATETIME
When filtering on a column of type
⦁ MMM dd, yy
⦁ MM/dd/yy
⦁ MM-dd-yy
⦁ MMM-dd-yy
⦁ yyyy.MM.dd
⦁ dd-MMM-yy
⦁ MMM/yy
⦁ MMM yy
⦁ dd/MMM/yy
⦁ yyyy
DATETIME
, the <value> should be formatted as one of the following supported formats:⦁ MMM dd, yy
⦁ MM/dd/yy
⦁ MM-dd-yy
⦁ MMM-dd-yy
⦁ yyyy.MM.dd
⦁ dd-MMM-yy
⦁ MMM/yy
⦁ MMM yy
⦁ dd/MMM/yy
⦁ yyyy
Oh, and by the way, you need timestamp >= , not timestamp =.
--
So would this work?
--
SELECT Message FROM <tableid> WHERE TargetUser = <currentuser> AND TimeStamp >= <LastTimeStamp>
Try it.
--
Catch the outgoing SQL statement somewhere so we can read it,
and see how it worked.
I'm not quite sure how to get the SQL statement, but it definitely worked! :)
Thanks!
--
I'm not quite sure how to get the SQL statement
use Do it, see also https://puravidaapps.com/ fusionerror.php
--
댓글 없음:
댓글 쓰기