Re: Group By / Order BY

2007-03-17 Thread Peter Brawley
70316 2this is version 2 This was the first one today but agian we needed to update. does that make sense? - Original Message - From: "Olexandr Melnyk" <[EMAIL PROTECTED]> To: "Justin" <[EMAIL PROTECTED]>; Sent: Saturday, March 17,

Re: Group By / Order BY

2007-03-17 Thread Justin
0316 2this is version 2 This was the first one today but agian we needed to update. does that make sense? - Original Message - From: "Olexandr Melnyk" <[EMAIL PROTECTED]> To: "Justin" <[EMAIL PROTECTED]>; Sent: Saturday, March 17, 200

Re: Group By / Order BY

2007-03-17 Thread Olexandr Melnyk
1) ORDER BY is executed after GROUP BY; 2) In ORDER BY don't use columns that aren't in GROUP BY, unless it's an aggregated value; Your query can be rewritten as: select date , max(rev) as max_rev from table group by date order by max_rev desc 2007/3/17, Justin <[EMAIL PROTECTED]>:

Re: GROUP BY ORDER BY

2005-05-31 Thread Michael Stassen
GROUP BY returns grouped columns and aggregate functions, not rows. You are grouping on history.person_id, so it makes no sense to select any column that does not have a unique value for each history.person_id. Indeed, other systems wouldn't even allow selecting non-grouped columns

Re: GROUP BY, ORDER BY clauses

2005-03-30 Thread Michael Genereux
Just keep in mind that the ORDER BY will require MySQL to take the full resultset and reorder it in a temporary table. MySQL has extended the GROUP BY clause as of version 3.23.34 so that you can also specify ASC and DESC after columns named in the clause. On Wed, 30 Mar 2005 10:53:38 -0500 (EST)

Re: GROUP BY, ORDER BY clauses

2005-03-30 Thread Asad Habib
Sorry for the confusion. In this case I am using the * to denote a field name instead of the wild card character. - Asad On Wed, 30 Mar 2005 [EMAIL PROTECTED] wrote: > Asad Habib <[EMAIL PROTECTED]> wrote on 03/30/2005 10:53:38 AM: > > > Does MySQL 4.1 support the use of GROUP BY and ORDER BY u

Re: GROUP BY, ORDER BY clauses

2005-03-30 Thread SGreen
Asad Habib <[EMAIL PROTECTED]> wrote on 03/30/2005 10:53:38 AM: > Does MySQL 4.1 support the use of GROUP BY and ORDER BY used in > conjunction with one another? I have tried to execute several queries > with both these clauses but the result set I get is different from what I > expect. My querie

Re: group by & order by rand() problem

2004-04-02 Thread Alessandro Astarita
Alle 21:57, giovedì 1 aprile 2004, Michael Stassen ha scritto: > You could probably accomplish this with a variant of the MAX-CONCAT > trick > . > Something like: > >SELECT user_id, > SUBSTRING(MAX(CONCAT(TRUNCATE(RAND

Re: group by & order by rand() problem

2004-04-01 Thread Michael Stassen
Right. You're grouping by user_id and throwing in title, and you're hoping to influence which of the titles is chosen to go with user_id, but as title is neither part of your group nor part of an aggregate function, its value is undefined. See the manual for an explanation

RE: group by & order by rand() problem

2004-03-31 Thread m.pheasant
-Original Message- From: Dathan Vance Pattishall [mailto:[EMAIL PROTECTED] Sent: Thursday, April 01, 2004 7:16 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: group by & order by rand() problem Try seeding your rand. > -Original Message- > From: [EMAIL PROTECTED] [mai

RE: group by & order by rand() problem

2004-03-31 Thread [EMAIL PROTECTED]
> Try seeding your rand. Tried. It doesn't work. The select shows always the same records but in different order: SELECT * FROM banners GROUP BY user_id ORDER BY RAND(); first call ++-+---+ | id | user_id | title | ++-+---+ | 1 | 1 |

RE: group by & order by rand() problem

2004-03-31 Thread Dathan Vance Pattishall
Try seeding your rand. > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 31, 2004 12:57 PM > To: [EMAIL PROTECTED] > Subject: group by & order by rand() problem > > I have this table: > > mysql> select * from banners; > ++-+

Re: GROUP BY/ORDER BY Problem

2003-10-05 Thread Ed Smith
The SQL specification does allow aggregates in the ORDER BY. Does mySQL have any plans to add such functionality (or at least add it to its list of things it doesn't do)? The problem with the solution of ordering by an alias is that I may not necessarily want the thing I'm ordering by to be in th

Re: GROUP BY/ORDER BY Problem

2003-10-04 Thread Paul DuBois
At 5:52 -0700 10/3/03, Ed Smith wrote: Why doesn't the following work: mysql> CREATE TABLE dog(id integer, breed char(20), age integer, weight integer) ; mysql> SELECT breed, MIN(age) -> FROM dog -> GROUP BY breed -> ORDER BY MIN(age); ERROR : Invalid use of group function I don't

RE: GROUP BY ORDER BY

2003-07-24 Thread Gary Broughton
EMAIL PROTECTED] Subject: Re: GROUP BY ORDER BY "Gary Broughton" <[EMAIL PROTECTED]> wrote: > > I wonder if someone could help with what I assume is a simple query > using GROUP and/or ORDER statements (something I struggle to get to > grips with). I am trying to get a li

Re: GROUP BY ORDER BY

2003-07-24 Thread Victoria Reznichenko
"Gary Broughton" <[EMAIL PROTECTED]> wrote: > > I wonder if someone could help with what I assume is a simple query > using GROUP and/or ORDER statements (something I struggle to get to > grips with). I am trying to get a list of users who have posted to a > forum by number of posts descending, b

Re: GROUP BY ORDER BY

2003-07-24 Thread John Wunderly
try this: order by 1 desc -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]