Well I have in the MYSQL database the chatlogs table with: from, to, msg, datetime.
Where are the messages exchanged and information ok, starting from this point I would like to know how to do a history of the messages, for example:
user carlos logged into his account in maria's chat so he 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 Hi, how are you? joana: Yes, and you? carlos: td ok
of correct order + I do not know how I would have done it,
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 joined with union everything and then I had to receive in order by datehr.
Any suggestions?