title: mysql join 3 tables and display result with WHERE payment = PENDING
body: <p>i have 3 tables</p>
  
  <pre><code>abd_table
    product_name
    price
    quantity
    total_cost
    session_id
    date
  
  order_detail_table
    order_id
    product_name
    price
    quantity
    total_cost
    session_id
    order_date
  
  order_table
    order_id
    payment_status (PAID,PENDING)
    order_date
    session_id
  </code></pre>
  
  <p>I want to retreive rows </p>
  
  <p>1) WHERE same PRODUCT DETAILS dont exists or match in abd_table and order_detail_table from same session</p>
  
  <p>2) WHERE nw.payment_status = PENDING</p>
  
  <p>If i remove WHERE CONDITION from below query then it dispaly all rows whether the payment_status is pending or not. 
  if i insert WHERE CONDITION in the below query then it display nothing.</p>
  
  <pre><code>$qry="select 
  a.cart_id,a.date,a.quantity,a.total_cost,a.user_name,a.product_name,a.session_id,a.price,o.order_id,nw.payment_status,nw.session_id
  from abd_table AS a
  LEFT JOIN order_detail_table as o on a.session_id=o.session_id
  LEFT JOIN order_table as nw on o.session_id = nw.session_id
  where nw.payment_status = 'PENDING'";
  </code></pre>
  
  <p>so how to retreive rows</p>
  
  <p>1) WHERE same PRODUCT DETAILS dont exists or match in abd_table and order_detail_table from same session. </p>
  
  <p>2) WHERE nw.payment_status = PENDING</p>
  
  <p>vineet</p>