write sql query following source table

jan feb mar apr
100 200 300 400
500 600 700 800
900 100 200 300
i want the output format like

month total
jan 1500
feb 900
mar 1200
apr 1500

Answer Posted / chanakya123

Hi, Using UNION ALL ,You can achieve it, here is Your Query

SELECT 'JAN' AS MONTH, SUM(JAN) AS TOTAL FROM SRC_MONTHS
UNION ALL
SELECT 'FEB' AS MONTH, SUM(FEB) AS TOTAL FROM SRC_MONTHS
UNION ALL
SELECT 'MAR' AS MONTH, SUM(MAR) AS TOTAL FROM SRC_MONTHS
UNION ALL
SELECT 'APR' AS MONTH, SUM(APR) AS TOTAL FROM SRC_MONTHS

Thanks
Kalyan Sankuthula

Is This Answer Correct ?    23 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explian the Process of deployment groups in informatica

653


What are the different transaction levels available in transaction control transformation?

671


How to generate sequence numbers?

616


Did u used latest transformations of 8.6.0? for what?

1473


What is informatica? Why do we need it?

633






What is union transformation in informatica?

695


How to start a workflow using pmcmd command?

707


Can we use the mapping parameters or variables created in one mapping into any other reusable transformation?

803


Can u generate reports in Informatica?

651


My source is delimited flat file Flat file data is H|Date D1|ravi|bangalore D2|raju|pune T|4 The data will be send to target if the fallowing two conditions satisfied 1.The first row Date column is equal to SYSDATE 2.Last record second port equal to number of records. How to achieve?

5566


What are the guidelines to be followed while using union transformation?

635


What do you mean by enterprise data warehousing?

638


What is the use of source qualifier?

667


What is informatica?

675


Explain Dataware house architecture .how data flow from intial to end?

2120