By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,379 Members | 1,396 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,379 IT Pros & Developers. It's quick & easy.

getdate function help

P: 2
here is my question with getdate function

--12. List the names and staff number for staff who manage detached properties that have a current lease i.e. there is a lease and its end date is in the future. Show each staff member only once
-- (Hint the getdate() function returns todays date)

i have this so farr

select fname, lname, s.staffno from staff s inner join property p
on s.staffno = p.staffno inner join lease l
on p.propertyno = l.propertyno
where type = 'detached'

where do i insert the getdate function (btw the current lease is called enddate)

And for question 4

Count the unleased properties assigned to each staff member who is employed at branch in Ottawa.. Sequence the output by highest to lowest count.

NOTE . A property is unleased if there is no lease or the lease has expired (End date is before current date . Hint getdate() function)

select count(leaseno) as 'unleashed properties assigned to staff in ottawa' from lease where propertyno in
(select distinct propertyno from property where staffno in
(select distinct staffno from staff where branchno in
(select distinct branchno from branch where type = 'ottawa')));
Mar 28 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 1,134
This looks like a homework question, so I will give you a hint.

you only want to return the records where the enddate is in the future, ie enddate is greater than todays date.
Where do you put statements that you want to filter your recordset where a field is greater than some value.
Mar 30 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.