Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Spliting Data in a month

Author  Topic 

shinu
Starting Member

2 Posts

Posted - 2005-06-02 : 03:44:14
hi friends...
I need a help pls…

I have Data in table which has a field named Date. I want to group them and take count on the basis whether they come in the First or second half of a month. There will be only one month at a time. Result will be like this



(No Column Name) Count
FirstHalf 23344
SecondHalf 56753

Thanking you,

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-06-02 : 04:26:14

select 'FirstHalf' ,count(*) as 'Count' from yourTable where day(dateCol)<=15
union all
select 'Second Half',count(*) as 'Count' from yourTable where day(datecol)>15



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

shinu
Starting Member

2 Posts

Posted - 2005-06-02 : 05:42:43

There you are da!
Thanks a lot Madhivanan. I was planning a big function for this.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-06-02 : 05:59:45
quote:
Originally posted by shinu


There you are da!
Thanks a lot Madhivanan. I was planning a big function for this.



Well shinu. Tell me the place and time

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -