Hi, thanks for replying.
I hope i can explain correctly :
a. I have 2 table that need to be joined.
b. I have 3 types of data to select from between these 2 tables.
all records from Enq which do not find a match in Budget
all records from Enq where the field visitid has null value but field enquiryid
has a value which can be matched in Budget
* all records from Enq where the field visitid has a value which cannot be found
in Budget.
Records have to be scanned to check that both the enquiryid and visitid fields of Budget return null values. My problem is the second and third have records which can be subsets of the first.
The field visitid comes from a third table called Visit.
I tried this code but it doesnt return any records although a physical verifcation indicates that 5 should have been selected.
$sql = "SELECT `Enq`.* FROM `Enq` LEFT JOIN `Budget`
ON `Enq`.Enquiryid=`Budget`.Enquiryid WHERE `Budget`.Enquiryid IS NULL
AND `Enq`.Visitid=`Budget`.Visitid AND `Budget`.Visitid IS NULL
AND ( (`Enq`.`Visitid`= '0' || `Enq`.`Visitid` IS NULL)
AND `Enq`.Category!= 'D' AND `Enq`.Category!= 'A' )
Any suggestions pl? Thanks.