i have a table / I have a table: id_msg - int (255) autoincrement id_user - varchar (255)
chat_id -varchar (255)
msg - text
ava_img - varchar (500)
first_name- varchar (500)
time_of_msg -timestamp [CURRENT_TIMESTAMP]
I need to get all the lines (with the output of all the fields) but without repeating the value of the chat_id field, when using group by I get an error about non-aggregating data
SELECT * FROM in_msg GROUP BY chat_id HAVING count(DISTINCT chat_id) > 1
*i. all table fields? you need to decide which fields you really need and what values to show for fields not participating in the group by, i.e. apply max / min / sum functions to them - Mike