Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

How to group by an aliased field?

$
0
0

Hi there

Why the following SQL clause is not working for the MS SQL 2012 (BTrieve is Ok with it):

select a, b, 'Hint: Processed '+a as Hint, Sum(s) from MyTable group by a, b, Hint

The error message is

Invalid column name 'Hint'

If there any way not to make duplications like

select a, b, 'Hint: Processed '+a as Hint, Sum(s) from MyTable group by a, b,  'Hint: Processed '+a ?

Thanks.


Viewing all articles
Browse latest Browse all 8428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>