SQL Query Using Data from 2 tables -
i have 2 tables: authors , books.
in authors have attributes authorid, authorname, , authordob.
authorid primary key in table.
in books table have attributes bookisbn, authorid, etc.
bookisbn primary , authorid foreign key
i trying perform query given author name, perform count of books author.
here got:
set @id = authorid authors ('mark twain' = authorname); select count(*) books (authorid = id);
any appreciated
try:
select a.authorid, a.authorname, count(*) authors inner join books b on b.authorid=a.authorid ('mark twain' = a.authorname) group a.authorid, a.authorname
Comments
Post a Comment