Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with query with a date 1

Status
Not open for further replies.

cheryl27284

Technical User
Jan 31, 2003
28
0
0
US
I have a query where I want to return records with the month instead of the date. The records are listed by day. Here is the Query:

Select MONTH(row_date) as Mnth,sum(acwtime)/sum(acdcalls) as acw from dagent group by ???

I need to group by the month so I do not get every record but I keep getting a syntax error. If I group by row_date it gives me every day. This works in SQL Server but not in Informix. Can anyone help?
 
And this ?
Select MONTH(row_date) as Mnth,sum(acwtime)/sum(acdcalls) as acw from dagent group by 1
Or this ?
Select MONTH(row_date) as Mnth,sum(acwtime)/sum(acdcalls) as acw from dagent group by MONTH(row_date)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
That worked!! Why group by 1? I know I could not group by month(row_date) but I tried the group by 1 and it worked?? What does that mean to group by 1?
 
Group by the 1st column.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top