I forgot the important part: what I want is to filter on a userID in the
person table such as -
SELECT u.Username, p.UserID
FROM Users u LEFT OUTER JOIN
Person p ON u.UserID = p.UserID
WHERE (p.UserID = 5) OR
(p.UserID IS NULL)
THis will return both the matching recs from the user table and NULLs from
the person table in sql server, but is what I cant get to work in mysql...
_____
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 19, 2005 3:14 PM
To: Rich Brant
Cc: [email protected]
Subject: Re: mysql syntax
Rich Brant <[EMAIL PROTECTED]> wrote on 04/19/2005 03:05:51 PM:
> I'm used to doing something simple such as the following in sql server:
>
> SELECT u.Username, p.UserID
> FROM Users u LEFT JOIN
> Person p ON u.UserID = p.UserID
>
> However, I'm not seeing the same results in MySQL. I don't get all
> the recs in the users table and NULLs in the userID column from the
> person table when the users.userID is not in the person table. I get
> no recs at all. What am I missing here?
>
> Thanks!
>
I don't see any obvious problems with your query. I use LEFT JOINs all the
time.
Which version MySQL are you using? Can you give us an example of what your
base data looks like (Users table and Person table), and what you actually
got as a response?
Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine