Need help with SQL Query
| From: | Rikin Parekh | Date: | Fri, 13 Apr 2012 12:54:28 +0000 |
| Subject: | Need help with SQL Query | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-48256@lists.php.net to get a copy of this message | ||
Suppose I have a *BOOKS* table like the one given below:
ISBN | Book Title | Author Name
1 Jungle book Sam
2 Princess Diary Joe
3 Titanic Sam
4 House Joe
5 Scary Movie Rick
6 Wonders Harry
7 Java Rick
I am trying to write a query which will give the *total number of book
titles written by each author*. The final result should be like
Author Name Count
Sam 2
joe 2
Rick 2
Harry 1
Can someone help me with this ?? I have tried
Select Author Name, COUNT(Book_Title) as Count
From Books
Group By (Author Name)
Will this above query work fine and give the results as shown?
Thank you in advance
Rikin