MYSQL how to ignore a table in a 3 table query if it doesnt satisfy the statement
- by user165242
I am trying to have information displayed for this query:
SELECT o.sub_number,o.unique_id,o.period_from,o.period_to,o.total_amt,i.paid_amt,i.dated,i.payment,i.paid_by,i.entered_date,i.paid_for_unique,j.cheque_num,j.drawn_on,j.dated AS cheque_dated
FROM paid_details o, payment_details i,cheque j
WHERE o.unique_id=i.unique_id AND o.unique_id=j.unique_id AND o.sub_number IN(SELECT sub_number FROM paid_details WHERE unique_id LIKE '%1271437707%');
it flops. Well the problem is sometimes the cheque might not have any information in it. So how do i get MYSQL to ignore that table and still continue displaying the rest of the information?
thanks!