0
Good have in MYSQL database table chatlogs with: from,for,msg,datetime.
Where are the messages exchanged and information ok, starting from this point I would like to know how to make a history of the messages, example:
Carlos logged into his account in Maria’s chat then would retrieve the old conversations again in order by datahr using datetime
Ex:
select msg from chatlogs where de = joana and para = carlos order by datetime ... conseguiria recuperar o historico msgs dela em ordem ... porem preciso que o histórico mostre tudo em ordem minhas msg tambem ...
Ex:
Joana:hi Carlos: Hey, what’s up? Joana: Yes and you? carlos: td ok
correct order + I don’t know how I would do, had tried so:
select msg from chatlogs where de = joana and para = carlos
union
select msg from chatlogs where de = carlos and para = joana
order by datetime
Explanation of what I tried to do: I tried to get all msg sent from Carlos to Joana and all msg from Joana to Carlos and I joined with Union everything and then I had it sent in order by datahr.
Any suggestions?
Although I prefer the @Thiagothaison solution below, what you have should work. Which problem gave?
– bfavaretto
opa thanks to attention bfavaretto , then it is because I am unable to test now and as I had needed and a boy said that way it would not work I came to find a solution , it is always good to spare doq missing kkk
– Junior Vieira