i have a library database which wrote a query to display count of loaned books by employee like this:
select Emploee.[Emp-No],count(*) as ecount
from Emploee
inner join Loan on Emploee.[Emp-No]=Loan.[Emp-No]
inner join Book on Loan.ISBN=Book.ISBN group by Emploee.[Emp-No]
the result of above query is something like this:
Emp-No ecount
------------------
1000 4
1001 2
1002 3
now i want to modify the output and make a comparison between ecount column of each row of result with another query which give me count of loaned books based on specific published by that user in other word the result im looking for is something like this
Emp-No ecount
-----------------
1000 4
assume Employee 1000 loaned all of his book from one publisher. he will be showen in the result.
something like this
"..... my query...." having ecount=
(select count(*) from books where publisher='A')
but i cant use the result ecount in another query :(