I have a query which I need to get records from 2 tables.
The records I need to pull out must need to be unequal in a specific field.
But there are records that that specific field value is both equal and unequal i.e. 2 or more rows.
If there is an equal record I don't need to retrieve the unequal rows...
here is an example of what I wrote
Code: Select all
<?php
SELECT tbl1.field1 ,tbl1.filed2,tbl1.field3,tbl2.field2 FROM tbl1,tbl2 WHERE tbl1.field1=tbl2.field1 AND tbl1.field2=tbl2.field2 AND tbl1.field3<>tbl2.field3 AND tbl1.field3 NOT IN (SELECT SELECT tbl1.field1 ,tbl1.filed2,tbl1.field3,tbl2.field2 FROM tbl1,tbl2 WHERE tbl1.field1=tbl2.field1 AND tbl1.field2=tbl2.field2 AND tbl1.field3=tbl2.field3);
?>I get a syntax error on this..
any ideas?
thanks