On 6 Jan 2004 at 9:31, Noamn wrote: > Rory wrote: > The query is behaving exactly as it should. Your query asks it to return > only those > workers that are listed in the webprojectassign table. Seeing as there are > no entries in > the webprojectassign table, no workers match and hence no results are > produced. > > No'am adds: > I think that Tyler wanted the workers who aren't listed in the > webprojectassign table - his query contains > WHERE worker.workerid!=webprojectassign.workerid > > Is != a different way of writing <>? > > If he wants the unassigned workers, then he needs what I've seen referred to > as a 'theta join', and I too would be interested to see how to do this in > mySQL. When I've needed such a query, to find 'childless' records, I've > always done it with a looped query in the client program. > > > -----Original Message----- > From: Rory McKinley [mailto:[EMAIL PROTECTED] > Sent: Tuesday, January 06, 2004 9:19 AM > To: Tyler Longren; [EMAIL PROTECTED] > Subject: Re: A little help with this select? > > > On 6 Jan 2004 at 1:00, Tyler Longren wrote: > > > Hi, > > > > I'm baffled. Been lookin at this for the last hour now. > > > > SELECT worker.fname,worker.lname,worker.workerid FROM > > worker,webprojectassign WHERE worker.workerid!=webprojectassign.workerid > > ORDER BY worker.lname ASC; > > > > That's the SQL in question. There's currently nothing in the > > webprojectassign table. So shouldn't this SQL just return the > > fname,lname,workerid from the "workers" table? Could someone just > > explain to me why this doesn't work the way I expected it to? > > > > > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > >
Oooops...my apologies to all...I guess it helps if one actually reads properly. In this case, the solution to Tyler's problem will be a left join. The query should look something like this : SELECT worker.fname,worker.lname,worker.workerid FROM > > worker LEFT JOIN webprojectassign ON worker.workerid = webprojectassign.workerid WHERE webprojectassign.workerid IS NULL > > ORDER BY worker.lname ASC This will retrieve all the worker details where there are no matching entries in the webprojectassign table. Rory McKinley Nebula Solutions +27 82 857 2391 [EMAIL PROTECTED] "There are 10 kinds of people in this world, those who understand binary and those who don't" (Unknown)