RE: sorting/grouping

2003-10-06 Thread Alec . Cawley
I think you want just "ORDER BY commentid DESC" .The previous answer orders by commentref first, which is not what I think you want. Maybe you want "ORDER BY commentid, commentref DESC" This doesn't seem to be making sure that the "newest" com

RE: sorting/grouping

2003-10-06 Thread Paul DuBois
At 12:09 -0400 10/6/03, Cummings, Shawn (GNAPs) wrote: For instance; mysql> select commentid, commentref from comments GROUP BY commentref ORDER by commentref DESC, commentid; +---++ | commentid | commentref | +---++ |80 |188 | |73 |

RE: sorting/grouping

2003-10-06 Thread Paul DuBois
At 12:01 -0400 10/6/03, Cummings, Shawn (GNAPs) wrote: This doesn't seem to be making sure that the "newest" commentid is the result... Seems to be random. Your requirements are unclear. If you want output sorted by descending order of commentid, then your original query should produce that. In

Re: sorting/grouping

2003-10-06 Thread Joseph Bueno
Have you tried: select commentref,max(commentid) from comments group by commentref Regards, Joseph Bueno Cummings, Shawn (GNAPs) wrote: This doesn't seem to be making sure that the "newest" commentid is the result... Seems to be random. At 09:11 AM 10/6/2003 -0400, you wrote: try select co

RE: sorting/grouping

2003-10-06 Thread Cummings, Shawn (GNAPs)
For instance; mysql> select commentid, commentref from comments GROUP BY commentref ORDER by commentref DESC, commentid; +---++ | commentid | commentref | +---++ |80 |188 | |73 |187 | |76 |185 | |56

RE: sorting/grouping

2003-10-06 Thread Cummings, Shawn (GNAPs)
This doesn't seem to be making sure that the "newest" commentid is the result... Seems to be random. At 09:11 AM 10/6/2003 -0400, you wrote: try select commentid, commentref from comments ORDER by commentref ,commentid DESC; > -Original Message- > From: Cummings, Shawn (GNAPs) [mailt

RE: sorting/grouping

2003-10-06 Thread Dan Greene
try select commentid, commentref from comments ORDER by commentref ,commentid DESC; > -Original Message- > From: Cummings, Shawn (GNAPs) [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 02, 2003 2:37 PM > To: [EMAIL PROTECTED] > Subject: sorting/grouping > > > > > I have a v