JPro
JPro

Reputation: 6556

proper sql structure

I have a table results, which has he following columns:

ID TestCase Platform
1  P1.1.1   Win1
2  P2       Win1
3  P3       Win3
4  P1.1.1   Win3

I have specific category of Platform's Only 4 Win1,Win2,Win3,Win4 Testcases will repeat for each and every Platform.

Now, what I am confused is :

I need to List all the distinct TestCases,their count belonging to each Platform and

i.e    
Platform  TestCases  
Win1      P1.1.1  
Win1      P2  
Win3      P1.1.1  
Win3      P3  

Win1_Count = 2  
Win3_count = 3  

Can anyone please give me any idea on how to do this?

Thanks.

Upvotes: 0

Views: 54

Answers (1)

codaddict
codaddict

Reputation: 455272

select distinct(Platform,TestCases) from tab order by Platform;

select Platform,count(*) as count from tab group by Platform order by Platform;

Upvotes: 3

Related Questions