Skip to content
Advertisement

MySQL: how do I select Non duplicates from one column without affecting others?

enter image description here

I’d like to be able to pull all the order_ID’s in the provided SQL table but rather than just pull them, have it list the amount of Order_ID’s to each user that has submitted one such as an example below rather than it list each individual row. From what I read the group_concat would come into play but im a little unsure on the Query.

Lezenko 1,2,3,4,5,7

Mr. Smith 6

Thanks!

Advertisement

Answer

What you are looking for is group_concat() function. You find the documentation here

select user_submitted, group_concat(order_id) as order_id from mytable group by user_submitted
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement