hi - happy new year to all
am writing a search page that will return a customers details if they have records in the following tables, book OR colldelbook OR courtcarbook
at the moment all records of customers are being returned
because of the left joins
am writing a search page that will return a customers details if they have records in the following tables, book OR colldelbook OR courtcarbook
at the moment all records of customers are being returned
because of the left joins
Code:
SELECT colldelbook.bookid AS cdbookid, book.bookid AS motbookid, courtcarbook.courtcarbookid AS courtcarbookid,cus.cusid, cus.fname, cus.lname, cus.add1, cus.pcode, cus.hphone, cus.wphone,cus.mphone,car.reg, book.bookdate AS motdate, colldelbook.bookdate AS cdbookdate, courtcarbook.bookst
FROM cus
INNER JOIN car ON car.cusid = cus.cusid
LEFT JOIN book ON book.carid = car.cusid
LEFT JOIN colldelbook ON colldelbook.carid = car.cusid
LEFT JOIN courtcarbook ON courtcarbook.cusid = cus.cusid "_
WHERE pcode = '" & replace(x_postcquick,"'","''") & "'"_
OR lname = '" & replace(x_lnamequick,"'","''") & "'"_
OR reg= '" & replace(x_stockregquick,"'","''") & "'"_
ORDER BY book.bookdate, colldelbook.bookdate, courtcarbook.bookst