HOW TO MERGE IN ONE!
-
Hi All, I want to count records any time from Mid day(12:00:00.000') of a given date up to the next day MID Day get all the count in to the first date. For instance for a date '2008-04-23' count is made between '2008-04-23 12:00:00.000 and 2008-04-24 12:00:00.000'. If my date Query is Between '2008-04-20' and '2008-04-23' then 1. '2008-04-20' --------- count on '2008-04-20 12:00:00.000 and 2008-04-21 12:00:00.000'. 2. '2008-04-21' ---------- count on '2008-04-21 12:00:00.000 and 2008-04-22 12:00:00.000'. etc.. Can you give me a script for this one? Thank you regards
-
Hi All, I want to count records any time from Mid day(12:00:00.000') of a given date up to the next day MID Day get all the count in to the first date. For instance for a date '2008-04-23' count is made between '2008-04-23 12:00:00.000 and 2008-04-24 12:00:00.000'. If my date Query is Between '2008-04-20' and '2008-04-23' then 1. '2008-04-20' --------- count on '2008-04-20 12:00:00.000 and 2008-04-21 12:00:00.000'. 2. '2008-04-21' ---------- count on '2008-04-21 12:00:00.000 and 2008-04-22 12:00:00.000'. etc.. Can you give me a script for this one? Thank you regards
hope this will help you...
select count(*) from myTable where [columndate] >= substring(convert(varchar,columnName,20),1,10)+' 12:00:00.000' and [columndate] <= substring(convert(varchar,columnName,20),1,10)+' 12:00:00.000'
I Love T-SQL
modified on Thursday, April 24, 2008 4:26 PM