SQL to count rows in Goup By query?
From: Bach Nguyen <bachn_at_diamond.zed.com>
Date: Mon, 30 May 1994 23:58:03 GMT
Message-ID: <1994May30.235803.6724_at_zed.com>
Date: Mon, 30 May 1994 23:58:03 GMT
Message-ID: <1994May30.235803.6724_at_zed.com>
Hi
Is it possible to write a single sql to get the number of rows returned in a Select query containing a Group By clause?
ex: workorder
workorderID priority
1 M 2 L 3 L 4 H 5 M 6 L
sql1) SELECT priority, count(priority) from workorder GROUP BY priority;
res1) priority count(priority)
M 2 L 3 H 1 total rows return: 3 rows.
I know in Access, we can do something like creating 2 queries. Second one running a count base on the first one.
query1: SELECT priority from workorder group by priority; query2: SELECT COUNT(priority) from query1;
thanks in advance
Bach
--
|Internet: aruba!bachn_at_uu2.psi.com Bach Nguyen |UUCP : ...!uunet!uupsi2!aruba!bachn Club Zed |Received on Tue May 31 1994 - 01:58:03 CEST
--------------------------------------------------------------------------