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

From: Date: Tue, 08 Aug 2000 11:46:20 +0000
Subject: Re: AW: [PHP-DB] Order by multiple tables
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-1848@lists.php.net to get a copy of this message
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 SB> "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 (#1848) next »