sql - How to group MySQL query by multiple criterias? -


here's i'm trying achieve. have table:

table 'receipts':  fruit   |receipt| name         |  no   | --------|-------|------- apple   | 534   | mike apple   | 422   | mike apple   | 355   | mike peach   | 646   | robert banana  | 412   | alex banana  | 124   | alex banana  | 067   | sam banana  | 975   | sam banana  | 645   | sam 

and want display each unique combination, each item every person has:

apple   | mike peach   | robert banana  | alex banana  | sam 

i can manage either group things fruit or name, no idea how done. can help?

select fruit, name tablename  group fruit, name 

or if want have unique combination, can

select fruit, name mytable group concat(fruit,'-', name) //group data based on unique word formed 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -