On Fri, 16 Nov 2001 10:41:31 +0530, Manish Mehta used a
few recycled electrons to form:
| Hello ,
| 
|     I have a problem related to not <> or != (not equal to function) .
| 
|     The SQL Query is
| 
|     select a.cBook_Name from tbl_bookmaster as a , tbl_empbookrelation  as b
|     where a.nbook_id != b.nbook_id
| 
|     It shows me wrong result. It shows me those rows also which are already
| present in other table.

You should use a left join, instead.

SELECT a.cBook_Name
 FROM
  tbl_bookmaster a LEFT JOIN tbl_empbookrelation b
 ON
  a.nbook_id = b.nbook_id
 WHERE
   b.nbook_id IS NULL

This is guessing that you want the records that are in
tbl_bookmaster, but not in tbl_empbookrelation.

HTH,
Michael



---------------------------------------------------------------------
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

Reply via email to