RE: [PHP-DB] IF ..THEN

From: Date: Tue, 06 Nov 2001 22:16:18 +0000
Subject: RE: [PHP-DB] IF ..THEN
Groups: php.db 
Request: Send a blank email to php-db+get-14075@lists.php.net to get a copy of this message
SELECT IF( t1.color="red", table1.col1, table2.col2) as comp FROM t1,t2 WHERE some_condition Look at: MySQL manual para. 6.3.1.4, Control Flow Functions -----Original Message----- From: Sharif Islam [mailto:mislam@students.uiuc.edu] Sent: Tuesday, November 06, 2001 3:28 PM To: php-db@lists.php.net Subject: [PHP-DB] IF ..THEN Is it possible in SQL to look into two different tables depending on the data? For example: Name Attribute X S.Black Y S.Blue Z T.White W T.Red can i do something like this? IF Attribute=S.(something) THEN look into Table 1 and return col1 else look into Table2 and return col2. I am using S. and T. as substring to separate the data.I guess then when I will display it , i have to parse it to. Any hint? thanks ) (( |""|-. | :|/' -`--'- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#14075) next »