2021年1月2日星期六

Compare value of rows SUM in SQL query

I would like to select the rows where OutgoingInvoice.TPP field not equals the SUM of Products.IncomingSUM where the OutgoingInvoice.ID = Products.OutgoingInvoice

I wrote this SQL query:

SELECT j.* FROM OutgoingInvoice AS j WHERE (((j.TPP)<>(select sum (jj.IncomingSUM) from Products as jj where jj.OutgoingInvoice = j.ID ) ));

It do not shows any rows, but there are some. What do I wrong?

https://stackoverflow.com/questions/65545738/compare-value-of-rows-sum-in-sql-query January 03, 2021 at 09:07AM

没有评论:

发表评论