Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write sql query following table

city gender no
chennai male 40
chennai female 35
bangalore male 25
bangalore female 25
mumbai female 15

i want the required output

city male female
chennai 40 35
bangalore 25 25
mumbai 15

Answer Posted / sudheer

Select ABC.CITY AS CITY, sum(ABC.male) as MALE, sum(ABC.Female) as FEMALE from

(
select city, Sum(no) as male, NULL AS female from table_name
where gender = 'male'
Group by city

UNION

select city, NULL as male, SUM(no) AS female from table_name
where gender = 'female'
Group by city

) ABC Group by CITY

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different types of repositories created using informatica?

1143


Please let me know how to make encryption and decryption with example?

1908


How does the aggregator transformation handle null values?

1152


i have a data in my source as a flat files what test i have to perform the next step can any body help to me

2129


What will happen if the select list columns in the custom override sql query and the output ports order in sq transformation do not match?

978


What are the new features of informatica 9.x in developer level?

1002


What if the source is a flat-file?

1120


server hot-ws270 is connect to Repository B. What does it mean?

2569


what is size of u r database?

2312


Define Pmrep command?

1070


Parameter and variable differences

2063


What is the way to execute pl/sql script using informatica mapping?

1618


How to use procedural logic inside infromatica? If yes how, if now how can we use external procedural logic in informatica?

1131


Differences between version 7.x and 8.x.

1900


what are the deliverables?in your project?

2153