sql - how make query about some of a field are equal? -
i'm trying code below
select sum(price) faktor date=date
but shows total of price. want show sum of per day like:
date ----- sum 2015/5/1 12345 2015/5/2 54124
i have tried below code error:
select date,sum(price) faktor date=date
[err] 42000 - [sql server]column 'faktor.date' invalid in select list because not contained in either aggregate function or group clause.
try
select [date],sum([price]) faktor group [date]
not sure why you'd use date=date, left out.
Comments
Post a Comment