aspose file tools*
The moose likes JDBC and the fly likes SQL Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQL Query" Watch "SQL Query" New topic
Author

SQL Query

Krish Khan
Ranch Hand

Joined: Dec 14, 2009
Posts: 46
Hello everyone..

I am poor in writing sql queries so i need help...


in my table i have two columns like: team and result_code
team is simple name of different teams, whereas in result_code i have repetation of four types of values like rpc, tpc,npc and sis

Now i need to display team and its relative count of 'rpc' that each team has...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61215
    
  66

Please take the time to choose the correct forum for your posts. This forum is for questions on Swing. For more information, please read this.

This post has been moved to a more appropriate forum.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Pawan Komaram
Ranch Hand

Joined: Dec 08, 2009
Posts: 91
select team, count(result_code) as reputation where result_code = 'rpc' group by team;
Pawan Komaram
Ranch Hand

Joined: Dec 08, 2009
Posts: 91
select team, count(result_code) as reputation from mytable where result_code = 'rpc' group by team;
Krish Khan
Ranch Hand

Joined: Dec 14, 2009
Posts: 46
not just for rpc but i need to get count for tpc too which is in same column.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQL Query