Thursday, June 21, 2012

Error while using group by clause

Column 'tblSales.Salary' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.

select ts.SalesmenName,ts.Age,sum(tp.Quantity) as Quantity
from tblSales ts
inner join tblProduct tp on ts.SId=tp.SId
group by tp.SId,ts.SalesmenName,ts.Age

Output :
SalesmenName        Age   Quantity 
 Rajesh             26      3
 Mohan              24      2

No comments:

Post a Comment



Custom Search
Protected by Copyscape Plagiarism Software