Re: Cross tab based on DateDIFF
- From: "Russell Fields" <russellfields@xxxxxxxxxx>
- Date: Thu, 15 Nov 2007 14:02:47 -0500
Geoff,
Is this what you are after?
SELECT
SUM (CASE
WHEN Col1 >= 0 THEN 1
ELSE 0
END) AS NonNegative,
SUM (CASE
WHEN Col1 >= 0 THEN 0
ELSE 1
END) AS Negative
FROM YourTable
--RLF
"Geoff" <Geoff@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:253BF539-8139-4E63-B824-73440A6302E9@xxxxxxxxxxxxxxxx
I'm trying trying to build a crosstab query using a Case statement to
count
the number of records in one column with the DateDiff >=0 and the other
column to be a count of the Records with the DateDiff <0. I can do this
easlily in MS Access with the IIF Function in a crosstab query but I can't
get the Sql Statement to work in an MS Sql 2000 View
.
- Follow-Ups:
- Re: Cross tab based on DateDIFF
- From: Geoff
- Re: Cross tab based on DateDIFF
- Prev by Date: Re: adding a query as parameter using 'contains' logic
- Next by Date: Re: Cross tab based on DateDIFF
- Previous by thread: Re: adding a query as parameter using 'contains' logic
- Next by thread: Re: Cross tab based on DateDIFF
- Index(es):
Relevant Pages
|
|