SQL: Using select and except to insert
Answer that worked.
http://stackoverflow.com/questions/11941188/how-to-insert-into-a-static-table-using-except
INSERT rd_scs_only_clients
select * from (
SELECT DISTINCT en.clientid_c
FROM cd.enrollments en
WHERE en.agency_c in ('SCCR','SCRP') AND DATEDIFF(DAY, GETDATE(), startdate_d) > 90
EXCEPT
SELECT DISTINCT en.clientid_c
FROM cd.enrollments en
WHERE en.agency_c not in ('SCCR','SCRP')
)DATA
http://stackoverflow.com/questions/11941188/how-to-insert-into-a-static-table-using-except
Comments
Post a Comment