angela4eva
Programmer
i have atble with three fields
date1 amount of datetime and money
10/2/2006 11:00 am $4
10/3/2006 12:01 pm $5
10/2/2006 5:02 pm $6
10/5/2006 12:20 am $7
10/6/2006 12:01 pm $7
10/3/2006 9:00 am $3
10/2/2006 6:00 pm $9
now i want to count the number of days that have a transaction..
one day is actually a timerange between 12
m to 12
m
so one day is 10/2/2006 12:00pm to 10/3/2006 12pm
doen't matter how many per day but if there is even one tramsaction between the time range.
I wrote a stored proc that takes in date date range
datebegin=10/2/2006 dateend=10/6/2006
then it should look for days to between 10/2/2006 12:00pm to 10/6/2006 12:00pm then
we
10/2/2006 12:00pm --10/3/2006 12:00pm --1 days
10/3/2006 12:00pm --10/4/2006 12:00pm --1 days
10/4/2006 12:00pm --10/5/2006 12:00pm --1 days
10/5/2006 12:00pm --10/6/2006 12:00pm --1 days
so there are total four days but
____________________________________________________
10/2/2006 12:00pm --10/3/2006 12:00pm this will be counted as one day
------------------------------------------------------
10/2/2006 5:02 pm $6
10/2/2006 6:00 pm $9
10/3/2006 9:00 am $3
__________________________________________________
_______________________________________________
10/3/2006 12:00pm --10/4/2006 12:00pm this will be counted as one day
_----------------------------------------------
10/3/2006 12:01 pm $5
___________________________________________________
10/4/2006 12:00pm --10/5/2006 12:00pm no trransaction ---------so this will be counted 0 days
_______________________________________________
_____________________________________________________
10/5/2006 12:00pm --10/6/2006 12:00pm --no transactions ------------so 0 so this be counted a zero days
------------------------------------------------------
_____________________________________________________
so the sql query should returrn number 2 instead of number 4
date1 amount of datetime and money
10/2/2006 11:00 am $4
10/3/2006 12:01 pm $5
10/2/2006 5:02 pm $6
10/5/2006 12:20 am $7
10/6/2006 12:01 pm $7
10/3/2006 9:00 am $3
10/2/2006 6:00 pm $9
now i want to count the number of days that have a transaction..
one day is actually a timerange between 12
so one day is 10/2/2006 12:00pm to 10/3/2006 12pm
doen't matter how many per day but if there is even one tramsaction between the time range.
I wrote a stored proc that takes in date date range
datebegin=10/2/2006 dateend=10/6/2006
then it should look for days to between 10/2/2006 12:00pm to 10/6/2006 12:00pm then
we
10/2/2006 12:00pm --10/3/2006 12:00pm --1 days
10/3/2006 12:00pm --10/4/2006 12:00pm --1 days
10/4/2006 12:00pm --10/5/2006 12:00pm --1 days
10/5/2006 12:00pm --10/6/2006 12:00pm --1 days
so there are total four days but
____________________________________________________
10/2/2006 12:00pm --10/3/2006 12:00pm this will be counted as one day
------------------------------------------------------
10/2/2006 5:02 pm $6
10/2/2006 6:00 pm $9
10/3/2006 9:00 am $3
__________________________________________________
_______________________________________________
10/3/2006 12:00pm --10/4/2006 12:00pm this will be counted as one day
_----------------------------------------------
10/3/2006 12:01 pm $5
___________________________________________________
10/4/2006 12:00pm --10/5/2006 12:00pm no trransaction ---------so this will be counted 0 days
_______________________________________________
_____________________________________________________
10/5/2006 12:00pm --10/6/2006 12:00pm --no transactions ------------so 0 so this be counted a zero days
------------------------------------------------------
_____________________________________________________
so the sql query should returrn number 2 instead of number 4