I have 2 tables like that
ChatList Table COLUMNS : ID INTEGER PRIMARY KEY, PHONE, DISPLAYNAME, SESSIONID
Messages Table COLUMNS : ID INTEGER PRIMARY KEY, [DATETIME], [FROM], [TO], [TYPE], [MESSAGE], [ISGROUP], [GROUPID], [READED], [SESSIONID], [MESSAGEID], [DISPLAYNAME]
I want get last record from messages table to chatlist join
SELECT m.ID as MID, m.DATETIME, c.ID, c.DISPLAYNAME, c.PHONE, c.SESSIONID, m.TYPE, m.MESSAGE
FROM [CHATLIST] as c
, [MESSAGES] as m
WHERE m.SESSIONID = c.SESSIONID
GROUP BY c.SESSIONID
ORDER BY MID DESC
It's not working
You forgot to add the LIMIT