SQL Query Help

  • Hello,

    I am creating a phone list and the list is refreshed daily using a scheduled job. What happens is the daily data gets populated into a staging table, then updates the active table.

    The staging table (DailyUserList) contains the complete list of users who should be on the phone list.

    The active table (Users), retains all current and historic user data.

    What I would like to do is create a query that will set a user record and Activestatus to 0 if they are no longer on the daily list?

  • pseudocode

    update currentlist

    set active = 0

    from currentlist cl

    where not exists (select * from dailyload dl where cl.phonenumber = dl.phonenumber)

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

  • Thank you very much!

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

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