Re: Problem related to not equal to function

2001-11-15 Thread Michael Brunson

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




Problem related to not equal to function

2001-11-15 Thread Manish Mehta

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.

Manish Mehta
E-mail: [EMAIL PROTECTED]




-
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