Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SP help
Message
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Title:
Miscellaneous
Thread ID:
01304357
Message ID:
01304404
Views:
12
Thank you! That helps a lot.

I still need to join with CON_PHONE table to get the correct set of records so I added that back in (TYPE and DNC fields are part of that table).

Then at the end I think I just need to add a select to get the records I want returned:
SELECT DISTINCT consumer.idnum, res1_fn, res1_int, res1_ln, res1_suf, group_ID,
addr1, addr2, city, state, zip, zip4, county, res1_dob, res1_Bm, res1_by,phone
FROM consumer LEFT JOIN CON_PHONE ON consumer.idnum = CON_PHONE.IDNUM inner join @temp temp on consumer.idnum = temp.idnum
>
>NOT TESTED
>Especially look in that part:
>
>   INSERT INTO @Temp
>   SELECT consumer.idnum,
>          consumer.OLD_POOL
>   FROM consumer
>        WHERE consumer.IDNUM > 0            AND
>              consumer.ORIG_SOURCE <> 'RES' AND
>              LEADSTATUS = ' '              AND
>              TYPE NOT IN (9, 10)           AND
>              DNC=0                         AND
>              DNCFLAG = ' '                 AND
>              consumer.state = @ST          AND
>              County = @County
>
>
>To see if I get the right records
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform