I have a table that holds data about exported bills. Each bill has a vendor. There is a separate table which has items from that bill.
So there are multiple bills for a vendor and then again multiple line items per bill.
I'm not sure how to delete a vendor from the database. I need to loop through the bill table. Then for each bill that has that vendor I need to use that bill ID to delete all line items with that bill ID from the line items table.
I just don't know how I loop through the bill table and act on each bill id. If anyone could offer an explanation on how i do it that would be great. Cheers
I'm using SQL Server 2008