Hi,

I'm having trouble getting a group-by query working. First I had this working bit of SQL:

Code:
select year(date1+numberofdays), week(date1+numberofdays), sum(qty) 
from pub.table 
group by year(date1+numberofdays), week(date1+numberofdays)
(date1 is a date and numberofdays an integer.)

The problem is that where I'm from, the week starts on Monday, but this database is using the North American standard where it starts with Sunday. So I thought I could just subtract the date with 1 day, but then I get a "non-group-by expression in select clause" error, with the SQL looking like this:

Code:
select year(date1+numberofdays), week(date1+numberofdays-1), sum(qty) 
from pub.table 
group by year(date1+numberofdays), week(date1+numberofdays-1)
But it works if I select the subtracted date without the aggregate function, like this:

Code:
select year(date1+numberofdays), week(date1+numberofdays-1), qty from pub.table
What's the problem? It's a Progress 10.1A database.

Thank you!