Problem with converting view from 2000 to 2008

  • You probably need to put the filters in the JOINs so that all the flights will show.

    Something like:

    SELECT [...]

    FROM flights f,

    LEFT JOIN person bs

    ON f.bs_pilot = bs.number

    LEFT JOIN person fs

    ON F.fs_pilot = fs.number

    LEFT JOIN person_allocation fsa

    ON f.fs_pilot = fsa.number

    AND (Sign(datediff(mi,f.exec_date,fsa.join_date)) *

    ISNULL(sign(datediff(mi,f.exec_date,fsa.leave_date)),1)= -1

    OR Sign(datediff(mi,f.exec_date,fsa.join_date)) = 0

    OR sign(datediff(mi,f.exec_date,fsa.leave_date)) = 0)

    LEFT JOIN aircraft_allocation aa

    ON f.tail_number = aa.tail_number

    AND (Sign(datediff(mi,f.exec_date,aa.begin_date)) *

    ISNULL(sign(datediff(mi,f.exec_date,aa.end_date)),1)= -1

    OR Sign(datediff(mi,f.exec_date,aa.begin_date)) = 0

    OR sign(datediff(mi,f.exec_date,aa.end_date)) = 0)

    LEFT JOIN person_allocation bsa

    ON f.bs_pilot = bsa.number

    AND (fsa.organismID = 5 OR bsa.organismId = 5)

    AND (Sign(datediff(mi,f.exec_date,bsa.join_date)) *

    ISNULL(sign(datediff(mi,f.exec_date,bsa.leave_date)),1)= -1

    OR Sign(datediff(mi,f.exec_date,bsa.join_date)) = 0

    OR sign(datediff(mi,f.exec_date,bsa.leave_date)) = 0)

  • Yes that's it.

    Thank you verry much.

Viewing 2 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply