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!

How to GROUP BY var created from Case-when statement

Status
Not open for further replies.

devon59

Technical User
Nov 30, 2005
18
US
Can anyone help?
I would like to group the records by the variable I created from case when statement but I got an error saying that that new variable is not part of the table. For example, this is what I have.

Select A, B, C,
case when A=1 then 'Y' else 'N' end as Flag
from Client_table
group by Flag
Thank you
 
group by case when A=1 then 'Y' else 'N' end
 
Thank you so much pwise. That worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top