Re: MySQL --- OR in a select statement ???
| From: | Joe Stump | Date: | Tue, 06 Feb 2001 05:56:03 +0000 |
| Subject: | Re: MySQL --- OR in a select statement ??? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-38353@lists.php.net to get a copy of this message | ||
You could do this:
users admins
----- ------
userID userID
fname
lname
select U.* from users U, admins A where A.userID=U.userID && (U.userID=100 ||
U.userID=101)
you could also use the IN () function ...
select U.* from users U, admins A where A.userID=U.userID && U.userID
in (100,101,400,500)
Hope this helps!
--Joe
On Mon, Feb 05, 2001 at 11:34:21PM -0600, Dallas Kropka wrote:
>
>
> Is it possible to include an OR condition in a MySQL select on 2 different
> tables?
>
> I have 1 table of basic customers and one table of Admins, both tables
> "Relate" to the UserNum table containing UserNumber login password and
> privs, I want to select one field from the correct table based on the
> usernumber which is unique to all users and stored in the root User
> table.... trying to do something like this....
>
> 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?
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
-------------------------------------------------------------------------------
Joe Stump, PHP Hacker, joestump98@yahoo.com -o)
http://www.miester.org http://www.care2.com
/\\
"It's not enough to succeed. Everyone else must fail" -- Larry Ellison _\_V
-------------------------------------------------------------------------------