Link to home
Start Free TrialLog in
Avatar of amaimedia
amaimediaFlag for Bosnia and Herzegovina

asked on

Date interval

MS  SQL 2000
vb.net

Hi experts
I have a question
On sql server I have this table, which contains the next columns:
ID      checkInDate      checkOutDate      sVID
1      10/14/2007      10/19/2007            2
2      10/14/2007      10/19/2007            2
3      10/16/2007      10/19/2007            1
4      10/14/2007      10/20/2007            1
5      10/15/2007      10/21/2007            2

Where is a sVID foreign key from another table.
I shuold write a Query ,Stored Procedure,Functions... This should have two parameters which are from a interval
for example.
@datOD datetime = 10/13/2007
@datDO datetime = 10/20/2007
For each date from the top interval, I have to get the next:
10/13/2007 no rows
10/14/2007
sVID      numOfsVID
2              2
1              1
where is numOfsVID number of  sVID-s
10/15/2007
sVID      numOfsVID
2             3
1             1
etc...
At the end i should have a table which looks like this one:
sVID      10/13/2007      10/14/2007      10/15/2007
2                 0                      2                     3
1                 0                      1                     1

ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of amaimedia

ASKER

Excellent thank you very much.