MYSQL how to ignore a table in a 3 table query if it doesnt satisfy the statement

Posted by user165242 on Stack Overflow See other posts from Stack Overflow or by user165242
Published on 2010-04-16T17:56:48Z Indexed on 2010/04/16 18:03 UTC
Read the original article Hit count: 213

Filed under:

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!

© Stack Overflow or respective owner

Related posts about mysql-query