Jonathan;
Try:
with t1 as ( select rpan8, count(*)
from f0311
group by rpan8
having count(*) > 1000
order by rpan8
)
select * from t1
Duane Christen
--
Duane Christen
Senior Software Engineer
(319) 790-7162
Duane.Christen@xxxxxxxxxx
Visit PAETEC.COM
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Jonathan Mason
Sent: Tuesday, August 18, 2009 8:51 AM
To: midrange-l@xxxxxxxxxxxx
Subject: Referencing columns in temporary tables using SQL
I am trying to run an SQL statement that creates a temporary table over which I want to run some selection criteria:
with t1 as ( select rpan8, count(*)
from f0311
group by rpan8
order by rpan8
)
select * from t1
Ideally I would like to add a "WHERE" clause to the select to only show entries where the COUNT(*) is more than a given amount, say 10000.
However, I can't find any way to reference the generated column as I don't know the internal name assigned to the column.
I have tried using "where count(*) > 10000" and other variations, but all to no avail. Does anybody have any ideas?
Thanks
Jonathan
Jonathan Mason
iSeries Consultant
www.astradyne-uk.com
_______________________________________________________
This message was sent using NOCC v1.14 webmail software _______________________________________________________
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.