0

I'm looking for a sql command solution for this problem. I want to retrieve all the rows that have the same atribute and list them. I've tried group by, but it merges the results into one row per chosen field. I want to retrieve the multiple results to do something like, without making single queries for each 'color':

  • black
    • nissan
    • toyota
  • red
    • ferrari
  • yellow
    • porsche
    • lambo
  • the below link can help you.. [enter link description here][1] [enter link description here][2] [1]: http://stackoverflow.com/questions/451856/querying-based-on-a-set-of-named-attributes-values [2]: http://stackoverflow.com/questions/4097266/basic-sql-selecting-the-same-column-multiple-times-in-one-query-when-each-occ thanx – user2499974 Aug 23 '13 at 05:08

1 Answers1

0

Well, queries produce a rectangular result set, not a hierarchical one, but something like this would work:

SELECT Color, Make
FROM Cars
ORDER By Color, Make

Then when you display the results you can show the Color only when it changes.

D Stanley
  • 149,601
  • 11
  • 178
  • 240