Subject Re: [firebird-support] SQL help?
Author Ivan Prenosil
SELECT
Count(DISTINCT o.OrderDate)
...

Ivan


----- Original Message -----
From: "Lee Jenkins" <lee@...>
To: "Firebird-Support@..." <firebird-support@yahoogroups.com>
Sent: Wednesday, September 01, 2004 8:31 PM
Subject: [firebird-support] SQL help?


>
> I have a Table that has a Date field in it. What I would like to do is get
> the distinct number of records where the weekday is Monday. The statement
> below returns 196 which is the exact number of individual records where
> EXTRACT(WEEKDAY FROM o.OrderDate) = 1. What I want to know is how many
> distinctly different monday's there are (in this case there are exactly 2 in
> the table i queried on). I hope that I make sense here. Had dental work
> this morning and pain killer is kicking in.
>
> SELECT DISTINCT
> Count(o.OrderDate)
> FROM
> OrdersPermanent o
> WHERE
> o.OrderDate >= '1/1/2004' AND
> o.OrderDate <= '12/31/2004' AND
> (EXTRACT(WEEKDAY FROM o.OrderDate) = 1)
>
>
>
> Thank you,
>
> Lee