Re: Re: Need help with SQL Query

Rikin Parekh <[email protected]>
Newsgroups gmane.comp.php.database
Message-ID <[email protected]>
This is the sample data provided to me. I need to query this data only. And column name can be without spaces. I need to know the query that will give me the result irrespective of the syntax errors in question table. Can someone please guide or help?

Thanks,
Rikin

On Apr 13, 2012, at 9:12, "Jim Giner" <[email protected]> wrote:

> why don't you try it and see?  (altho I suspect that using 'count' as the 
> result field name might not work, and that having column names with spaces 
> in them will require quotes around them.)
> "Rikin Parekh" <[email protected]> wrote in message 
> news:CALbBjtc3S51Wm=GfZz6_mUW08iRfTC1v=MrzhQru3HX__u2R7A@mail.gmail.com...
>> 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
>> 
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.