i'm trying to display as you can see, all books and periodicals published by the same publisher in a certain year.
The code i placed below works, but one problem is this. The end result shows in this order:
"BookID Title PublisherName YearofPub"
BookID in this case is not quite the right heading for the column, as there are also periodicals in the list, and should actually read "BookID/PeriodicalID".
How can i make this possible? Or is there some way to go around this?
[Btw, i'm quite new to SQL and ACCESS as you can probably tell, so if anything in my code works but shouldn't be done that way, please let me know also... plenty thanks! ]
SELECT Books.BookID, Books.Title, Publisher.PublisherName, Books.YearofPub
FROM Publisher INNER JOIN Books ON Publisher.PublisherID = Books.Publisher
WHERE (((Publisher.PublisherName) Like [Enter Publisher Name]) AND ((Books.YearofPub) Like [Enter Year]));
UNION SELECT Periodical.PeriodicalID, Periodical.Title, Publisher.PublisherName, Periodical.YearPub
FROM Publisher INNER JOIN Periodical ON Publisher.PublisherID = Periodical.Publisher
WHERE (((Publisher.PublisherName) Like [Enter Publisher Name]) AND ((Periodical.YearPub) Like [Enter Year]));
The code i placed below works, but one problem is this. The end result shows in this order:
"BookID Title PublisherName YearofPub"
BookID in this case is not quite the right heading for the column, as there are also periodicals in the list, and should actually read "BookID/PeriodicalID".
How can i make this possible? Or is there some way to go around this?
[Btw, i'm quite new to SQL and ACCESS as you can probably tell, so if anything in my code works but shouldn't be done that way, please let me know also... plenty thanks! ]
SELECT Books.BookID, Books.Title, Publisher.PublisherName, Books.YearofPub
FROM Publisher INNER JOIN Books ON Publisher.PublisherID = Books.Publisher
WHERE (((Publisher.PublisherName) Like [Enter Publisher Name]) AND ((Books.YearofPub) Like [Enter Year]));
UNION SELECT Periodical.PeriodicalID, Periodical.Title, Publisher.PublisherName, Periodical.YearPub
FROM Publisher INNER JOIN Periodical ON Publisher.PublisherID = Periodical.Publisher
WHERE (((Publisher.PublisherName) Like [Enter Publisher Name]) AND ((Periodical.YearPub) Like [Enter Year]));