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
Mine is Insurance Domain, So interviewer asked about terms like underwriting, disbursement amt, Reinsurance
What is data movement mode in Informatica and difference between them?
One of the optimizing technique to improve the session performance is push down optimization,by using push down optimization we push as much as transformation logic to source/target database,but this degrades the d/b performance,how to overcome this?
How to generate sequence numbers?
What is a dimensional model?
What is a transaction control transformation?
Which files are created during the session rums by informatics server?
While importing the relational source definition from the database, what are the metadata of source that will be imported?
How to implement security measures using repository manager?
COL1,COL2 ABC,1 XYZ,2 HERE IN COL2 VALUES 1,2 NOT STSANDARD(IE MEANS NOT FIXED VALUES LIKE OTHER SOME VALUES LIKE 10,20) O/P IS COL1,COL2 ABC,2 XYZ,1
my source is junk data how will u remove that junk data by using unix please any one replay me
What is the difference between power center and power mart? What is the procedure for creating independent data marts from informatica 7.1?
In how many ways we can create ports?
Suppose we have two source qualifier transformations sq1 and sq2 connected to target tables tgt1 and tgt2 respectively. How do you ensure tgt2 is loaded after tgt1?
COM components can be used in Informatica