Вы можете использовать union all
:
SELECT 'TotalBooks', COUNT([Book ID]) AS total
FROM BookRegistration
UNION ALL
SELECT 'Borrowed', COUNT([Book ID])
FROM Borrowing;
Это создает две строки.
Или вложенные подзапросы для двух столбцов:
SELECT (SELECT COUNT([Book ID]) FROM BookRegistration) as TotalBooks,
(SELECT COUNT([Book ID]) FROM Borrowing) as BorrowedBooks;
Или переместить условияк предложению FROM
:
SELECT t.TotalBooks, b.BorrowedBooks
FROM (SELECT COUNT([Book ID]) AS TotalBooks FROM BookRegistration
) t CROSS JOIN
(SELECT COUNT([Book ID]) AS BorrowedBooks FROM Borrowing
) b ;