BOOK_ADOPTION (course:int, sem:int, book_isbn:int)
TEXT (book_isbn:int, booktitle: varchar(50), publisher: varchar(50), author: varchar(50))
List the books which are adopted by the course as well as enrolled by the student.
I am trying this:
select course
from text
natural join book_adoption
group by course
having count(book_isbn)>1
and publisher = 'perason';
and getting an error:
Unknown column 'publisher' in 'having clause'
but the column publisher is there and even the spelling is correct. Can someone help me out with this one?
CodePudding user response:
HAVING clause is for using with aggregating functions (like count) but in the case of publisher you have to simply use the WHERE condition.
select course
from text natural join book_adoption
where publisher = 'perason'
group by course
having count(book_isbn)>1;