Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to count common table expression

Status
Not open for further replies.

stoggers

Vendor
May 30, 2001
93
0
0
US
Hi,

How do you count the number of rows returned by the following statement:

WITH TEMP1 (D) AS
(VALUES DATE('01/01/2004') UNION ALL SELECT (D + 1 DAY) FROM TEMP1 WHERE (D + 1 DAY) < DATE('01/02/2004'))
(SELECT D,DAYOFWEEK(D) FROM TEMP1)

Thanks,

Mike.
 
Doh!

WITH TEMP1 (D) AS
(VALUES DATE('01/01/2004') UNION ALL SELECT (D + 1 DAY) FROM TEMP1 WHERE (D + 1 DAY) < DATE('01/02/2009'))
(SELECT COUNT(*) FROM TEMP1 WHERE DAYOFWEEK(D) IN (2,3,4,5,6))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top