* Dave > Thanks for your responses but it's not that much help I need with > my SQL ;-) > > None of the 3 suggestions work. > > Please look at the examples I gave. I need *all* UserIDs regardless of > whether they have a record in History that matches both UserID and WeekID.
...and that is what I thought my suggestion would do... > > SELECT u.UserID, IF(h.Points,h.Points,0) AS Points > > FROM Users AS u > > LEFT JOIN History AS h USING(UserID) > > WHERE ISNULL(WeekID) OR WeekID = 1 > > ORDER BY u.UserID Maybe you could tell us what error message you got, or in what way the query 'does not work'? -- Roger --------------------------------------------------------------------- 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