Date: Tue, 31 Jan 2006 13:38:45 -0600
Reply-To: Jiann-Shiun Huang <Jiann-Shiun.Huang@AMERUS.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jiann-Shiun Huang <Jiann-Shiun.Huang@AMERUS.COM>
Subject: Re: What's wrong with this Query?
Content-Type: text/plain; charset=US-ASCII
Jeff:
I made some correction on the code. Here is the revision. Ignore
the previous one and test this:
SELECT K10.EVENT_ID, K9.KOUNT
FROM
(SELECT MAX(KOUNT) AS KOUNT
FROM (SELECT COUNT(*) AS KOUNT, EVENT_ID
FROM ED_EVENT_HISTORY
GROUP BY EVENT_ID)) AS K9,
(SELECT COUNT(*) AS KOUNT, EVENT_ID
FROM ED_EVENT_HISTORY
GROUP BY EVENT_ID) AS K10
WHERE K9.KOUNT = K10.KOUNT;
J S Huang
1-515-557-3987
fax 1-515-557-2422
>>> Jeff Morison <jmt_mtf@YAHOO.COM> 1/31/2006 12:53:14 PM >>>
Can you tell my why this query gives the following
error message?.
Tia,
Jeff
The error is
Code = 3706.
3706: Syntax error: All expressions in a derived
table must have an explicit name.
Output directed to Answer set window
/*** Query ***/
SELECT K10.EVENT_ID, K9.KOUNT
FROM
(SELECT MAX(K.KOUNT)
FROM (SELECT COUNT(*) AS KOUNT, EVENT_ID
FROM( SELECT *
FROM
ED_EVENT_HISTORY AS EH) AS K
GROUP BY EVENT_ID) AS K) AS K9,
(SELECT COUNT(*) AS KOUNT, EVENT_ID
FROM( SELECT *
FROM ED_EVENT_HISTORY AS EH) AS K
GROUP BY K.EVENT_ID) AS K10
WHERE K9.KOUNT = K10.KOUNT
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com