Saturday, July 24, 2010

Write a SQL query from the following table to find the number of items available for each country and also replace the Country ‘India’ with alias ‘India-Asia’

Countrytable table

Country 
Item 
India 
A
England
B
India 
C
UAE
D
England
D
USA
E


Select
Case
            WHEN UPPER(Country) = 'INDIA' THEN 'Asia-India'
            Else Country
End , COUNT(*) from Countrytable
 group by Country

No comments:

Post a Comment


All Rights Reserved @ Raju Das