Re: MySQL --- OR in a select statement ???
| From: | (Chris Adams) | Date: | Tue, 06 Feb 2001 05:49:58 +0000 |
| Subject: | Re: MySQL --- OR in a select statement ??? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-38354@lists.php.net to get a copy of this message | ||
On 5 Feb 2001 21:27:13 -0800, Dallas Kropka <dallask@austin.rr.com> wrote:
>SELECT first_name FROM admin_table, user_table WHERE userNum = 1000
>
> The info will only be in one or the other.... but what (if any) is the
>correct syntax?
You mean something like
SELECT first_name FROM users
LEFT JOIN admin_table on users.userNum = admin_table.userNum
LEFT JOIN user_table on users.userNum = user_table.userNum
WHERE admin_table.userNum=1000 OR user_table.userNum = 1000
?
(Disclaimers: There's probably a more efficient way of doing this. I've just
finished an epic battle with MS SQL Server's poxy excuse for full-text
searching and don't feel list spending any more time playing around with SQL
statements this evening.)