getdate function help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • napjohn8
    New Member
    • Mar 2008
    • 2

    #1

    getdate function help

    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')));
  • Delerna
    Recognized Expert Top Contributor
    • Jan 2008
    • 1134

    #2
    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.

    Comment

    Working...