In my SQL Server database I have a list of items with a column for quantity. When an item sells, I want to reduce the quantity by 1. I import the sold items into a new table with:
create table DBase_Editor
(ItemID varchar (50) not null)
bulk insert DBase_Editor
from 'G:\DBase Editor.csv'
with
(firstrow = 2,
fieldterminator =',',
rowterminator = '\n')
Can somebody help me with a query that would reduce the Quantity column in table Vendor by 1 for each file in DBase_Editor by matching column 'ItemID' in table DBase_Editor with column 'identifier' in table Vendor? I then need a separate query that would on a second pass delete all records from table DBase_Editor where column 'quantity' is zero. Thank you.
Start Free Trial