this is just a shot in the dark but I assume you passing in @Matter_ID and @Project_ID?
See if this select would get all int_aux_favorites that you want deleted for a given matter_ID and Project_ID.
select iaf.*
from int_maslon_matter_recent immr
join int_aux_project iap on iap.project_cd = immr.MatterNumber
join int_aux_lst_custom ialc on immr.TimeKeeperNumber = ialc.string_value and LST_CUSTOM_DEF_ID = '-10017'
join int_user iu on iu.listing_id = ialc.listing_id
join int_aux_favorites iaf on iaf.user_id = iu.user_id and iaf.entity_id = iap.project_id
where immr.entity_id = @Project_ID
and immr.MatterNumber = @Matter_ID
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/