one_raven
05-27-08, 02:44 AM
I have a query in which I want to sort the results by date.
I only have a timestamp field (named: opened), with which to use.
An entry of the timestamp field looks like this:
5/11/2008 12:00:26 AM
Here is my query:
SELECT t.opened, (select count(environment) from Current where opened=t.opened) AS TOTAL, (select count(environment) from Current where environment="P" and opened=t.opened) AS PROD, (select count(environment) from Current where environment="C" and opened=t.opened) AS COB, (select count(environment) from Current where environment="U" and opened=t.opened) AS UAT, (select count(environment) from Current where environment="D" and opened=t.opened) AS DEV
FROM [Current] AS t
GROUP BY t.opened;
Unfortunately, it groups by the whole timestamp field, not by the date.
I want it to group by the date.
Please help.
I only have a timestamp field (named: opened), with which to use.
An entry of the timestamp field looks like this:
5/11/2008 12:00:26 AM
Here is my query:
SELECT t.opened, (select count(environment) from Current where opened=t.opened) AS TOTAL, (select count(environment) from Current where environment="P" and opened=t.opened) AS PROD, (select count(environment) from Current where environment="C" and opened=t.opened) AS COB, (select count(environment) from Current where environment="U" and opened=t.opened) AS UAT, (select count(environment) from Current where environment="D" and opened=t.opened) AS DEV
FROM [Current] AS t
GROUP BY t.opened;
Unfortunately, it groups by the whole timestamp field, not by the date.
I want it to group by the date.
Please help.