×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Guys, I have a file that has a number of locations.  I want to group all
locations less then 9995 as restaurants and then have two other locations
to be by themselves.

I have a workable select statement.

SELECT Case
          When STUNNO = 11111 then 'INTERNET'
          When STUNNO = 22222 then 'CORPORATE'
          ELSE 'ALL RESTAURANTS'
       end
from MYFILE


However, I want to be able to group by the result of the case.   For
instance, (this doesn't work)

SELECT Case
                  When STUNNO = 11111 then 'INTERNET'
                  When STUNNO = 22222 then 'CORPORATE'
                  ELSE 'ALL RESTAURANTS'
       end AS Location

from MYFILE
GROUP BY Location

It states that Location doesn't exist.  I understand why I get this
message, but I'm wondering how can I get this to work. If I'm able too.

I've tried to Group By STUNNO... but I get a record result for each unit,
even though it will return "ALL RESTAURANTS"... instead of the actual unit
number.

Thanks.


Michael Schutte


This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.