interesting.

of course, removing one of the limiting selection 
criteria would increase the number of possible 
selected records.

and the limit clause does not seem to be 
correctly constucted.

but forgive me if i just don't understand.

if you have a windows box for a front end, 
download corereader.  it will let you quickly 
experiment with point-and-click queries to debug 
query logic.    http://corereader.com


> >Description:
>       join with OR and LIMIT fails to return result
> >How-To-Repeat:
> 
> This query fails to return a result:
> 
> SELECT Subscriptions.UID
  FROM Subscriptions, Accounts 
  WHERE Accounts.UID = Subscriptions.User
    AND (Accounts.Email = 'bill' OR 
         Accounts.UName = 'bill')
  ORDER BY Subscriptions.Created DESC limit 1;
  Empty set (0.02 sec)
> 
> But, if I remove one of the parenthesized OR tokens, it works:
> 
> SELECT Subscriptions.UID 
  FROM Subscriptions, Accounts
  WHERE Accounts.UID = Subscriptions.User
      AND Accounts.UName = 'bill'
  ORDER BY Subscriptions.Created DESC limit 1;
> +-----+
ID |
> +-----+
> | 255 |
> +-----+
> 1 row in set (0.00 sec)
> 
> Or, if I remove the LIMIT, it works:
> 
> mysql> SELECT Subscriptions.UID FROM Subscriptions, Accounts WHERE 
> Accounts.UID = Subscriptions.User  AND (Accounts.Email = 'bill' OR 
> Accounts.UName = 'bill') ORDER BY Subscriptions.Created DESC;
> +-----+
> | UID |
> +-----+
> | 255 |
> +-----+
> 1 row in set (0.11 sec
> 
> I've already worked around this, I'm just letting you guys know.
> 
> 
> >Fix:
>       


-- 
        John Ragan
        [EMAIL PROTECTED]
        http://www.CoreReader.com/ 


---------------------------------------------------------------------
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