1
I have a history of conversations that are recorded in the table sql "conversation" and I want to pick up who was the last person who inserted a message in the conversation to know if it was the user who wrote last or if it was the admin (id 28).
Have some way to make a SELECT with a rule to know the last date or last id?
id|idusuario|idconversa| mensagem |data
1 | 700 | 2 | mensagem 1 |2018-05-24 10:20:21
2 | 28 | 2 | mensagem 2 |2018-05-24 10:30:21
I rode the next:
SELECT idusuario
FROM conversa
GROUP BY idconversa
Then when returning the last id that inserted the conversation I will do an if to say if it was the admin or the user (that part is already ok);
You’re doing it with PHP?
– Geraldão de Rívia
Yes, I’m doing it in PHP
– Leandro Marzullo