![]() |
SQL group by query problem
Database Query :
http://img822.imageshack.us/img822/8...eenshot1tv.jpg Database Query result: http://img137.imageshack.us/img137/6...reenshot2l.jpg SQL Code:
SELECT Invoice.iid, Invoice.idate, customer.cname, rep.sfname, invoice_stock.qty, invoice_stock.sellingMY SQL code with GROUP BY clause Code:
SELECT Invoice.iid, Invoice.idate, customer.cname, rep.sfname,SUM( invoice_stock.qty* invoice_stock.selling)can anyone point me out the error which I made ? |
Re: SQL group by query problem
What you are trying to get?
|
Re: SQL group by query problem
what I am trying to get is some details of invoice it should look like this
Invoice ID || Invoice DATE || Customer Name || Salesman Name || Invoice TOTAL |
Re: SQL group by query problem
And I see that you are getting the same as well. What error you are seeing the input. Have you checked if the date is only date and not date as well as time.
|
Re: SQL group by query problem
In the code for Group by, there are 5 columns including aggregate SUM, but the group by statement has only four columns which is incorrect. it should be 1 less than actual.
Try the below code. Code:
SELECT Invoice.iid, Invoice.idate, customer.cname, rep.sfname,SUM( invoice_stock.qty* invoice_stock.selling) |
Re: SQL group by query problem
Quote:
|
| All times are GMT +5.5. The time now is 03:47. |