Re: Nested select
- From: Hugo Kornelis <hugo@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 12 Mar 2006 22:53:54 +0100
On Fri, 10 Mar 2006 22:05:19 -0000, David Portas wrote:
(snip)
SELECT COUNT(*) AS countedorders
FROM
(SELECT DISTINCT [order]
FROM OrdersTable
WHERE customer='100000'
AND [order date] BETWEEN '20050101' AND '20051231'
) AS T ;
Hi David (& John),
Or even shorter:
SELECT COUNT(DISTINCT [order])
FROM OrdersTable
WHERE customer = '100000'
AND [order date] BETWEEN '20050101' AND '20051231'
(untested - see www.aspfaq.com/5006 if you prefer a tested reply)
--
Hugo Kornelis, SQL Server MVP
.
- Follow-Ups:
- Re: Nested select
- From: David Portas
- Re: Nested select
- References:
- Re: Nested select
- From: David Portas
- Re: Nested select
- Prev by Date: Re: Nested select
- Next by Date: Re: Help with a query please
- Previous by thread: Re: Nested select
- Next by thread: Re: Nested select
- Index(es):
Relevant Pages
|
|