Subject RE: [firebird-support] order by with grouping?
Author Leyne, Sean
Kelly,

> always a great place to get help!!
>
> here's what i have data wise:
>
> Tag ID Date
>
> ABC 11 2012
> DEF 11 2011
> GHJ 11 2010
> HHH 22 2012
> ZZZ 22 2011
> AAA 22 2010
> AAK 33 2012
> AAD 44 2012
> YYY 44 2010

>
> My desire is to still keep the "groups" of ID together
>
> i'd LIKE
>
> AAA 22
> HHH 22
> ZZZ 22
> AAD 44
> YYY 44
> AAK 33
> ABC 11
> DEF 11
> GHJ 11
>
> but
> select * order by tag, date group by ID doesn't work

First, your expected output and your SELECT don't align. Where is the Date column?

Second, stop using SELECT * very bad habit. Ok, for debugging/testing, bad for production.


> NOTE i do NOT want to sort by ID. I just want the list sorted by Tag,
> subsorted by date. BUT I want all the IDs together because the Tag might
> change from date to date for ID

Your post/requirements are contradictory:

- "My desire is to still keep the "groups" of ID together"

- "NOTE i do NOT want to sort by ID"

If you want them "together", they need to be sorted


- "I just want the list sorted by Tag, subsorted by date."

Which is it, do you want the ID together or the Tags by date?


Sean