There are tables
Order - idOrder , login , product , number ;
Payment - idPayment , orderId , number (the paid amount from the order in the table. Order ).
Tell me, please, SELECT queries:
- get the
Orderlines (orders) that are not referenced in thePaymenttable; - get
Orderlines (orders) which are referenced in thePaymenttable; - get
Orderlines (orders) that are referenced in thePaymenttable under the condition that thenumberfields in one and second tables are not equal, and the difference between these values, i.e.o.number-p.number;