[thelist] SQL Statement problem

Seth Bienek seth at sethbienek.com
Mon Feb 11 17:05:01 CST 2002

Hi Joshua,

> But it works fine if you change the GROUP BY to approved_date.

The problem with this approach, is that since I'm using coalesce to determine
which column populates that aliased column, I need to group by the alias.


Well, I found the solution.  I used the entire coalesce statement in the group
by clause and it seems to be acting right.  Thanks for the input all!

GROUP BY COALESCE (DATEPART(ww, approved_date), DATEPART(ww, terminate_date))



More information about the thelist mailing list