Thanks for the quick reply.

I was just using an example.  My code is a different select.  This was done for 
ease.  Thus i also didn't fill in the date as I just wanted to show that the ID 
is the same for ALL dates BUT the Tag might change on any given date.  
Obviously a select would return the date field too.

What i want is to sort by the Tag of the most recent date; THEN had all the 
other same ID of that Tag below it, sorted as well.

even though this is one table, it can be though of as a master-detail

master sort is by tag of the most recent
each of those IDs is subsorted

i might be phrasing it weird but

order by

tag ( where date is most recent)

group by
ID


phrased another way:

i want the IDs together or grouped

i want the IDs sorted by the Tag of the most recent one.

hth's
thanks
kelly


--- In firebird-support@yahoogroups.com, "Leyne, Sean"  wrote:
>
> 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
>


Reply via email to