mysql - SQL - selecting from multiple tables where one table returns no results -


i have 2 tables in database

- billing_supplier_invoices - billing_payments 

there multiple records in billing_payments each 1 record in billing_supplier_invoices , billing_supplier_invoices.sequence = billing_payments.seq

i want able select records billing_supplier_invoices sum of records (billing_payments.amount) not equal billing_supplier_invoices.grand_total

i have tried this:

select billing_supplier_invoices.*  billing_supplier_invoices  left join billing_payments       on  billing_supplier_invoices.sequence = billing_payments.invoice_sequence  type = 'supplier'  , billing_supplier_invoices.grand_total <> sum(billing_payments.amount) 

but sql error saying

error: invalid use of group commands

select  billing_supplier_invoices.*  billing_supplier_invoices  left join  billing_payments on billing_supplier_invoices.sequence = billing_payments.seq 

Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -