Just needed a quick help if anyone can provide. I have a column Product_name
with unique values in a table named Products
.
What I want to do is SELECT
each row of this table as a column and then for each row of this resulted query, if their exists a record with that specific transaction_id in a table named Transactiondetails
which contains the foreign key from the table Transactions
, pull up the quanity.
Table transactiondetails
is designed to make the structure of the database in 3rd normal form. For example for a specific transaction id, the number of products and their quantities are all in seperate rows in the table transactiondetails
with that specific transaction id.
Now, For example, if I have two products named product A
and product B
(that means two rows in the table products
), then the resulted query should show like this
transaction_id | product A | product B 1 | 5 | 10
I hope I made it understandable enough.
Any help would be highly appreciated.