I am doing a query in the database and am having difficulties with data duplication, so far, this is my query:
SELECT * FROM tec_postagens tp
INNER JOIN tec_historico_status th ON tp.protocolo=th.protocolo
WHERE tp.protocolo = '1168'
ORDER BY tp.protocolo DESC, tp.datahora DESC
The result is:
The first table is tec_postagens
, the second is tec_historico_status
, I need to show all the posts along with the data of tec_historico_status
Both have the same protocolo
What sets is datahora
I need to show in order of datahora
Thank you.