i have a table that receives entries from a shopping basket something like this
Now when a user checks out, the values of his basket are inserted into the above table.
NOw after payment is verified, i want to be able to put the value each into a unique table, showing each[B] item he purchased.
e.g. If there are 2 items in the shopping basket. then item3 and related tables woudl be empty
So i would want something like this
case items_purchased =
select count(item1), count(item2), count(item3) from inserted
for each item <> 0
insert into purchased_item (item, quantity, price)
values (item1, quantiy, price)
how do i achieve this correctly
TAKING NOTE, That the values inserted item1 would change for each loop. ie values (item1, quantity1, price1)
(item2, quantity2, price2)
for each non null value