c# - Query to see last 6 months records? -


select sum(invoice_amount) invoice_amount,        count(*) invoice_count  payment_exception pe   inner join invoice_details ind on ind.customer_referenceid = pe.id  pe.customer_code = '1001012'   , ind.status='submit'  

select sum(invoice_amount) invoice_amount,count(*) invoice_count  payment_exception pe inner join invoice_details ind on ind.customer_referenceid=pe.id  pe.customer_code='1001012' , ind.status='submit'   , ind.invoice_date>=dateadd(m,-6,getdate()) group invoice_amount 

you need add group condition .


Comments

Popular posts from this blog

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

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -