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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -