AW: AW: [PHP-DB] Order by multiple tables

From: Date: Tue, 08 Aug 2000 13:26:18 +0000
Subject: AW: AW: [PHP-DB] Order by multiple tables
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-1851@lists.php.net to get a copy of this message
That seems to work. But unfortunately not with MySQL. There is a function documented, called "TEMPORARY TABLE" which substitutes the UNION funtion, but when I try to use that one, I always get an error message. mfG Simon > -----Ursprüngliche Nachricht----- > Von: Alexey Borzov [mailto:borz_off@rdw.ru] > Gesendet: Dienstag, 8. August 2000 13:46 > An: Simon Biela > Cc: php-db@lists.php.net > Betreff: Re: AW: [PHP-DB] Order by multiple tables > > > Greetings, Simon! > > SELECT name, price > >FROM televisions > UNION > SELECT name, price > >FROM videorecorders > ORDER BY price DESC; > > or, in a more general way: > > RTFM ON 'SELECT'; > > > At 08.08.2000, 15:43, you wrote: > > SB> Ok! Thanks for all your help. But I think I am not making > myself clear - it > SB> may also be that I don't underdtand you. I am trying to give > you an example: > > SB> I have two tables. Let's call them "videorecorders" and > "televisions". I > SB> want to select all videorecorders and televisions and order > them by their > SB> price. So that I get a result like this: > > SB> videorecorder1 $500 > SB> television1 $399 > SB> television2 $250 > SB> videorecorder2 $101 > > SB> As you can imagine, it is not possible to put the videorecorders and > SB> televisions in one table, because they may all have a price > and a name, but > SB> a television compared to a videorecorder may have a screen > size or something > SB> else. > > SB> Hopefully you understand what I wanna do now. > > > > > -- > Yours, Alexey V. Borzov, Webmaster of RDW > >

« previous php.db (#1851) next »