Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
gretty
Starting Member
6 Posts |
Posted - 2009-10-23 : 21:55:13
|
I have this question that is really stumping me. I need to find the names of all authors who have written more than one book.Can you give me any advice on where I'm going wrong?quote: List the full names (first name followed by last name from table author) of authors who have written more than one title. The list should be sorted by last name and then first name (as a secondary sort key).
The tables(with their colums) involved are: quote: Author:-AUTHOR_NUM DECIMAL PRIMARY KEY,-AUTHOR_LAST-AUTHOR_FIRST
quote: Wrote:-BOOK_CODE-AUTHOR_NUM DECIMAL-SEQUENCE DECIMAL
I cannot get this to work..select author_first, author_lastfrom author, wrotewhere (select count(author_num) from wrote group by author_num) > 1 and author.author_num = wrote.author_numorder by author_last; |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-10-23 : 22:10:46
|
| select a.author_first + ' ' + author_last as FullNamefrom author ainner join wrote w on w.author_num = a.author_numgroup by a.author_last, a.author_firsthaving count(*) > 1order by a.author_last, a.author_firstBe One with the OptimizerTG |
 |
|
|
|
|
|