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? > > Maybe I'm doing something wrong. > > THANKS! > > Best Regards, > -- > Tyler Longren > J.D. Web Services, L.C. > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > >
Hi Tyler 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. In terms of the syntax of your query, if you wish to return records from the worker table when the webprojectassign table is empty, you either have to use a LEFT JOIN (which willl include all records from workers whether they have a matching workerid in webprojectassign or not) or remove the condition from your query above. In both cases you are no longer doing what your query originally intended (which I assume is to list all workers currently assigned to projects). If you are just testing, I would suggest that a better bet would be to put dummt entries into the empty table rather than hacking the query. Regards 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) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]