Facebook
From FARIS IZWAN BIN AHMAD FAUZI, 4 Years ago, written in SQL.
Embed
Download Paste or View Raw
Hits: 138
  1. SELECT COUNT(student_id) , rb.b_id , b_fix_amount , b_fix_amount*(COUNT(student_id)) FROM student_transaction st
  2. JOIN people p ON p.people_id = st.student_id
  3. JOIN receipt r ON r.r_id = st.r_id
  4. JOIN Receipt_Bill rb ON rb.r_id = r.r_id
  5. JOIN bill b ON b.b_id = rb.b_id
  6. WHERE p.o_id = '17' AND r_status_code != 'OPEN'
  7. GROUP BY rb.b_id;