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
 SQL Server Development (2000)
 SQL with month and day number in range of 2 dates

Author  Topic 

Vivaldi
Constraint Violating Yak Guru

298 Posts

Posted - 2001-03-30 : 20:12:45
Hey,

I am working late trying to finish up a simple report [so i thought] where a user
chooses a month and amount of days
and submits them to reveal a report that lists.

All people that have have been in the facility [jail] during the month specified and for at least the days specified within that month. (current year implied)

there are two important dates
Booking Date and Discharge Date.
Booking Date has to exist, discharge doesnt

Info table has
residentid | Name | bookingdate

discharge table has
residentid | dischargedate

I am doing this through an asp page so its a bit tricky for me using logic in a sql statement.

I would post my trys at this, but they are rather large and get extremely unreadable in this box.

I know the logic, but i want a way
to say if Discharge is NULL
then append (set of sql where statements)
else
append other sql where statements
end

I have been trying to read the t-sql but they only have one example style of using an if else statement in sql.

Any Help would be appreciated.



Software Composer
   

- Advertisement -