MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Martin Moss Date:July 24 2003 3:03pm
Subject:So simple, yet wonderful:-) Re: New Group By, order by question
View as plain text  
Thanks to everyone who Helped,

Regards

Marty

----- Original Message ----- 
From: "Joseph Bueno" <joseph.bueno@stripped>
To: "Martin Moss" <martin_moss@stripped>
Cc: <mysql@stripped>
Sent: Thursday, July 24, 2003 3:56 PM
Subject: Re: New Group By, order by question


> select .... order by abs(field) desc;
>
> Hope this helps,
> Joseph Bueno
>
> Martin Moss wrote:
> > All,
> >
> > I have a question about grouping numbers.
> >
> > Lets say I have 10 records each containing a numeric value:-
> >
> > 1
> > 2
> > 3
> > 5
> > 10
> > -1
> > -2
> > -3
> > -4
> > -5
> >
> > What I wish to do is to select the records from the database but group
them
> > like this :-
> > e.g. by the highest value (ASC or DESC) regarldess of whether the value
is
> > positive or negative?
> >
> > 10
> > 5
> > -5
> > -4
> > 3
> > -3
> > 2
> > -2
> > 1
> > -1
> >
> > Can I do this in one query, or do I need to make two queries
> >
> > Regards
> >
> > Marty
> >
> >
> >
> >
>
>
>

Thread
GROUP BY ORDER BYGary Broughton24 Jul
  • Re: GROUP BY ORDER BYVictoria Reznichenko24 Jul
    • RE: GROUP BY ORDER BYGary Broughton24 Jul
  • New Group By, order by questionMartin Moss24 Jul
    • Re: New Group By, order by questionNils Valentin24 Jul
    • Re: New Group By, order by questionJoseph Bueno24 Jul
  • So simple, yet wonderful:-) Re: New Group By, order by questionMartin Moss24 Jul
Re: GROUP BY ORDER BYJohn Wunderly24 Jul