Re: newbie: how to return one iteration *per unique date (DAY!)* in a timestamp column?

From: Date: Wed, 05 Aug 2009 21:31:00 +0000
Subject: Re: newbie: how to return one iteration *per unique date (DAY!)* in a timestamp column?
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.db 
Request: Send a blank email to php-db+get-46417@lists.php.net to get a copy of this message
> except that I just added the ORDER BY clause onto each SELECT segment, > and now I get this error: > query failed: Incorrect usage of UNION and ORDER BY > > How can I order the results while still doing the UNION ALLs? You should only need one ORDER BY clause at the end of the whole query: (SELECT...) UNION ALL (SELECT...) UNION ALL (SELECT...) ORDER BY... I'm not sure if this syntax is portable to other SQL-based DBMSes, though. I'm certain that one system we use at work doesn't support it, but it's kind of a dinosaur so I don't like to draw too many conclusions from what it doesn't support. Ben

« previous php.db (#46417) next »