select DISTINCT first_name, last_name, picture, last_active, id_participante1, id_participante2, id_user, [message], dataHora from chat_b_users inner join utilizadores
on chat_b_users.id_participante2 = utilizadores.id_user
left join chat_talks on chat_b_users.id_chat = chat_talks.id_chat
where id_participante1 = 1
union all
select DISTINCT first_name, last_name, picture, last_active, id_participante1, id_participante2, id_user, [message], dataHora from chat_b_users inner join utilizadores
on chat_b_users.id_participante1 = utilizadores.id_user
left join chat_talks on chat_b_users.id_chat = chat_talks.id_chat
where id_participante2 = 1 order by last_active DESC
how can i select a distinct value?
I need to return all this data even nulls but on of each user, how can i make this?
results:
as you can see in the image, i've two chats from the same user, i only want one of each.