Nice!  I never thought of naming the count result and sorting by it.
You never stop learning in this business!!!!

Dennis McGrath
Software Developer
QMI Security Solutions
1661 Glenlake Ave
Itasca IL 60143
630-980-8461
[email protected]
From: [email protected] [mailto:[email protected]] On Behalf Of Bruce A. Chitiea
Sent: Monday, June 10, 2013 9:16 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: FAIL: SELECT (expression) AS alias

Bill:

In your formulation, 'ORDER BY Stack DESC' now performs as expected.

Thanks for the clarity.

Bruce

From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]]<mailto:[mailto:[email protected]]> On Behalf Of Bill 
Downall
Sent: Sunday, June 09, 2013 7:12 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: FAIL: SELECT (expression) AS alias


Bruce,

You cannot "group by" a column that is used in an aggregate function (count, 
sum, min, max, avg). Turtle cannot be both after select and also the column in 
the count expression.

Maybe you want something like:

SELECT Turtle, COUNT(*) AS Stack +
FROM Salamasond +
WHERE KingOfThemAll LIKE 'Yertle' +
GROUP BY Turtle +
HAVING COUNT(*) > 10 +
ORDER BY Turtle
On Jun 9, 2013 9:50 PM, "Bruce A. Chitiea" 
<[email protected]<mailto:[email protected]>> wrote:
All:

I would like to 'ALIAS' an expression in a SELECT statement:

SELECT Turtle, COUNT(Turtle) AS Stack +
FROM Salamasond +
WHERE KingOfThemAll LIKE 'Yertle' +
GROUP BY Turtle,Stack +
HAVING Stack > 10 +
ORDER BY Stack,Turtle

... or column names to that effect, but what I get is an:

-ERROR- Column stack not found (2369)

Is there a way to 'package' the expression to have Mack's 'stack'
recognized?

Thanks

Bruce Chitiea
SafeSectors, Inc.
eCondoMetrics

Reply via email to