Romio_1968
Member
- Local time
- Today, 19:53
- Joined
- Jan 11, 2023
- Messages
- 126
I have the following table structure and relationships
I created a query that extracts data from the above tables. The SQL code for this Query is:
The output of the query is:
So for the first Title, I have one Title_ID, two Authors and also two copies, each one with its own inventory
The second one have Title_ID 2, no author, and inventory No.2
I need to obtain an output like this:
Title_ID 1 # Some Book # Dere, John; Doe, John; # Inventrory_No 1, 2
Title_ID 2 # Other Book # # Inventrory_No 3
So I need for each Title to merge somehow dte data in column.
If anybody can help,
Thank You
____________________________________________________________________
RESOLUTION
The solution for this thread is offered by ebs17 in his answer
Tested and worling
I created a query that extracts data from the above tables. The SQL code for this Query is:
Code:
SELECT Titles.Title_ID, Titles.Title, Author.Author_Name, Inventory.Inventory_No
FROM
(Titles INNER JOIN Inventory ON Titles.Title_ID = Inventory.Title_IDFK)
LEFT JOIN
(Author RIGHT JOIN TAJunction
ON Author.Author_ID = TAJunction.Author_IDFK)
ON Titles.Title_ID = TAJunction.Title_IDFK
ORDER BY Titles.Title_ID, Inventory.Inventory_No;
The output of the query is:
So for the first Title, I have one Title_ID, two Authors and also two copies, each one with its own inventory
The second one have Title_ID 2, no author, and inventory No.2
I need to obtain an output like this:
Title_ID 1 # Some Book # Dere, John; Doe, John; # Inventrory_No 1, 2
Title_ID 2 # Other Book # # Inventrory_No 3
So I need for each Title to merge somehow dte data in column.
If anybody can help,
Thank You
____________________________________________________________________
RESOLUTION
The solution for this thread is offered by ebs17 in his answer
Tested and worling
Attachments
Last edited: