Your query will work in every case, EXCEPT when either "Current" or
"Temporary" has 0 rows, because then there's nothing to join. I'm not sure
if doing a join is a "clean" way of doing this though.

If you know that "Current" will never be empty (but "temporary" might be),
then this query would work:

SELECT * FROM current
LEFT JOIN temporary ON 1=1
WHERE current.login = 'keric'
OR temporary.login = 'keric'

That won't work if "Current" is empty.

There's got to be a better way of doing this though... anyone else want to
take a crack at this problem?

On Tue, 14 Aug 2001, Eric Anderson wrote:

> I've got two tables, "Current" and "Temporary", Current has a row with
> login='keric', Temporary doesn't.
>
> The following query:
>
> mysql> select * from Current, Temporary where Current.login='username'
> or Temporary.login='username'
>     -> \g
> Empty set (0.01 sec)
>
> obviously doesn't work.  I want to know if that row exists in either
> table in one SQL call.  Maybe it's just me today..


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to