You want a LEFT JOIN:

Select messages.<fieldname>, users.<fieldname>, [more fields]
FROM messages LEFT JOIN users
        ON messages.userID = users.userID

-----Original Message-----
From: Russell Jones [mailto:[EMAIL PROTECTED]]
Sent: Saturday, October 21, 2000 12:10 PM
To: CF-Talk
Subject: Query Trouble



In a forum app, I have a table of messages that I'm going to query for
display. A field in that table is called "UserID".  Everywhere that "UserID"
is not "0", I'd like to query another table for that person's user info.

Q:

Is this something I could do all in one query, or should I do the first part
as one query and then worry about a second query where necessary while I'm
outputting the first one ..

I'm not sure if this calls for a JOIN, a Left JOIN, a UNION or what ...

Any ideas?

Thanks

-Russ

----------------------------------------------------------------------------
--------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a
message with 'unsubscribe' in the body to [EMAIL PROTECTED]
------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to