Row to column query ( Please its urgent)
The query is
SELECT
WO.WORKORDERKEY,
UDF1.PROJECT_MANAGER,
UDF1.TEAM_MANAGER,
UDF1.TEAM_LEAD,
UDF1.CUSTOMER_COORDINATOR,
UDF1.AVIONICS_LEAD,
UDF1.INTERIOR_LEAD,
UDF1.INSPECTOR,
UDF1.MECHANICAL_ENGINEER,
UDF1.AVIONICS_ENGINEER,
UDF1.PLANNER,
UDF1.PARTS_COORDINATOR,
UDF1.LOGO_HEADER_SELECTION
FROM
WORKORDERS WO,
SELECT
DISTINCT WOUD.WORKORDERKEY,
DECODE(UDF.LABEL,'Project Manager',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS PROJECT_MANAGER,
DECODE(UDF.LABEL,'Team Manager',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS TEAM_MANAGER,
DECODE(UDF.LABEL,'Team Lead',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS TEAM_LEAD,
DECODE(UDF.LABEL,'Customer Coordinator',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS CUSTOMER_COORDINATOR,
DECODE(UDF.LABEL,'Avionics Lead',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS AVIONICS_LEAD,
DECODE(UDF.LABEL,'Interior Lead',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS INTERIOR_LEAD,
DECODE(UDF.LABEL,'Inspector',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS INSPECTOR,
DECODE(UDF.LABEL,'Mechanical Engineer',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS MECHANICAL_ENGINEER,
DECODE(UDF.LABEL,'Avionics Engineer',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS AVIONICS_ENGINEER,
DECODE(UDF.LABEL,'Planner',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS PLANNER,
DECODE(UDF.LABEL,'Parts Coordinator',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS PARTS_COORDINATOR,
DECODE(UDF.LABEL,'Report Logo/Header Selection',SUBSTR(TO_CHAR(WOUD.DATA), 1, 50),NULL) AS LOGO_HEADER_SELECTION
FROM
USERDEFINEDFIELDS UDF,
WORKORDERUDFDATA WOUD
WHERE
UDF.USERDEFINEDFIELDKEY = WOUD.USERDEFINEDFIELDKEY
AND UDF.LABEL IN('Project Manager','Team Manager','Team Lead','Customer Coordinator','Avionics Lead','Interior Lead','Inspector','Mechanical Engineer','Avionics Engineer','Planner','Parts Coordinator','Report Logo/Header Selection')
AND UDF.DELETED = 0
AND WOUD.DELETED = 0
) UDF1
WHERE
WO.WORKORDERKEY = UDF1.WORKORDERKEY(+);
The output i am getting like:
WORKORDERKEY PROJECT_MANAGER TEAM_MANAGER TEAM_LEAD CUSTOMER_COORDINATOR
1 abc
2 ddf
2 rrr
3 aaf
3 ege
i need in single line work order key
WORKORDERKEY PROJECT_MANAGER TEAM_MANAGER TEAM_LEAD CUSTOMER_COORDINATOR
1 abc
2 ddf rrr
3 aaf ege
Please solve my problem.
maybe this example might be of some help.
SQL> select * from pivot_tab;
COL1 COL2
1 a
1 b
1 c
2 h
2 h
SQL>
SQL>
SQL> select p.col1,
2 substr(max(substr(sys_connect_by_path (p.col2,','),2)),1,60)
3 as col2
4 from (select col1,
5 col2,
6 row_number() over (partition by col1 order by col1, col2) rn
7 from pivot_tab) p
8 start with p.rn = 1
9 connect by p.rn = prior p.rn + 1
10 and prior p.col1 = p.col1
11 group by col1;
COL1 COL2
1 a,b,c
2 h,h
SQL>
Similar Messages
-
Suppress Overall result (both rows and columns side and its data)
Hello all,
I need to do some settings in BEx Query Designer, so that In BEx Analyzer, I don't see 'overall result' both on 'rows' and 'column' sides
This is what I have done so far
In 'rows' section, Properties of my KF (no. Products) then 'calculation' tab 'calculate result as'=Suppress result
This way in BEx Analyzer I don't see the FIGURES/DATA for 'Result' and 'overall result' BUT 'result' and 'overall result' still exist both on rows and colum side even if there are not figures in them.
Is there any property in BEx Designer so that I don't see 'overall result' at all
Best regards
Ahmadthanks for responding
selecting a characteristic, properties, Display tab, Result lines: Always Suppress
with this I don't see 'result'
but 'overall result' result exist both on 'rows' and 'column' side alongwith its data.
If I combine the above with this: selecting KF, properties, calucations, Calculate result as: Suppress result
then
I don't see the data in 'overall result' BUT 'overall result' still exist both on rows and column sides
any setting so that 'overall result' completely vanishes
Best regards
Ahsan -
Step by step bapi to convert SAP to XML please its urgent
step by step bapi to convert SAP to XML please its urgent
full points if with full example and coding in ABAP,
Thank you,
Regards,
Jagrut Shuklayes i want to convert Catsdb table into xml format and safely in server, i.e secured place
-
please its urgent
what are all the topics i will cover to thorough xml?
advanced thanxwhat are all the topics i will cover to thorough xml?What an odd question.
XML can be used to represent any set of data and therefore the topics it can cover can be anything you can think of.
Perhaps you meant something different. Perhaps you should be more clear in your requirements. Perhaps this isn't really urgent. Perhaps we're volunteers, not being paid to give you any more of our time than any other person. Perhaps you should learn netiquette. -
Please its urgent - I am planing to buy Iphone 4 in korea .. after it's working in India GSM - OR NOT??
If you buy an iphone 4 in Korea, it is carrier locked to SK telecom or Show, depending on which carrier you get it from. However you can request an unlock from the carrier, it is called, "Country Lock' in Korea. Normal procedure is you buy the iphone there, you then dial 114 on your iphone, and speak with the customer support. Ask them to Country Lock (unlock) the iphone. If you can't speak Korean, but have a Korean friend, let your friend do it for you.
It will take a few days and you will receive a text message notifying you that your Country Lock is ready. Then connect to itunes, follow the steps. -
thanks.. can u please help me out in one more question. how can i transfer files like pdf, .docx and ppt from my laptop to iPhone 5 ? please its urgent.
See your other post
First, i want to know how can i pair my iPhone 5 with my lenovo laptop? -
i want to make an identity card of my dad. he is a government employee. so can you send me whole method to make it using Photoshop CS2 ? please its urgent
Identity cards are not things individuals typically make.
You can get yourself into big trouble forging fake IDs.
-Noel -
Update a column (please its urgent)
I am trying to update a column while the command updates that specific column and replace the rest with blank.
i have written this command
UPDATE AU_POI_INTERM A SET (A. PREV_REL_IDX)= (SELECT REL13_IDX FROM TEMP_AU_POI_DUPLICATES B
WHERE B.REL13_SID='10143' AND B.NEW_IDX = A.IDX)
this is the maximum criteria i can use in where clause.It updated every row because you have no WHERE clause (on your update statement). Try this:
UPDATE AU_POI_INTERM A
SET (A. PREV_REL_IDX) = (SELECT REL13_IDX
FROM TEMP_AU_POI_DUPLICATES B
WHERE B.REL13_SID='10143'
AND B.NEW_IDX = A.IDX)
WHERE EXISTS (SELECT REL13_IDX
FROM TEMP_AU_POI_DUPLICATES B
WHERE B.REL13_SID='10143'
AND B.NEW_IDX = A.IDX)
; -
Need a SQL query(Pls Its urgent)
Hi,
I want a SQL query for the foll..
Details r below..
Table AFPFTRAN
BU TRansactiondate Amt
13202 10-04-05 10,000
13203 11-05-05 20,000
13202 20-04-05 5,000
Table AFGENCOD
BU Clerk Name Clerk Code
13202 Amit TFBG
13203 Anand TFMG
I want a query to get data as below..
Tr Date TFBG TFMG
Apr 15,000 0
May 0 20,000
JUn 0 0
Jul 0 0
Aug
Sep
Aug
Nov
DEc
Jan
Feb
Mar
I want this to achieve using a single query...?How can I achive this?
Pls give the sol...
Adios...
Prashanth DeshmukhDoes it look like you need ?
SQL> select * from t;
BU TDATE AMT
13202 10.04.05 10000
13203 11.05.05 20000
13202 20.04.05 5000
SQL> select * from t1;
BU NAME CODE
13202 Amit TFBG
13203 Anand TFMG
SQL> SELECT pivot_month.mname, tops.TFBG, tops.TFMG
2 from
3 (
4 select to_char(t.tdate,'MM') month_no,
5 sum(decode(t1.code,'TFBG',t.amt,0)) TFBG,
6 sum(decode(t1.code,'TFMG',t.amt,0)) TFMG
7 from t1, t
8 where t.bu=t1.bu
9 and to_char(t.tdate,'yyyy') = 2005
10 GROUP BY t1.code, to_char(t.tdate,'MM')
11 ) tops,
12 (select rownum mn, to_char(to_date(rownum,'MM'),'MON') mname,
13 case when rownum between 1 and 3 then rownum + 9
14 else rownum - 3 end rn
15 from dict where rownum < 13) pivot_month
16 where pivot_month.mn = tops.month_no (+)
17 order by pivot_month.rn
18 /
MNA TFBG TFMG
APR 15000 0
MAY 0 20000
JUN
JUL
AUG
SEP
OCT
NOV
DEC
JAN
FEB
MAR
12 rows selected.Rgds. -
Hi,
Currently we have a query (Created on Multicube - one is sales plan cube and another is Sales actuals).
When we run the query on a particular day (example: 7/10/2006), the report looks like as below:
Cal.Year/Month Sales plan Sales Actuals
Jan'06 310 305
Feb'06 280 277
Mar'06 310 309
Apr'06 300 300
MAy'06 310 305
June'06 300 305
July'06 310 90
The current report shows the whole month's Sales Plan (July'06 - 310) with Actual Sales for 9 days(for July'06 - 90). Whereas, We want to compare the sales Plan (first 9 days of the month) against the sales actuals for 9 days.
We do not have 0calday in both the cubes. Please help.
Thanks,David,
As rightly pointed out , you cannot get the plan value for 9 days if you do not have 0calday. However some things you can do...
1. Have a virtual KF which gets the number of days from the current calendar day ( system date ) to the first date of the month - this can be written with a simple exit since the first date is fixed.
2. calculate the plan value from that - pro rated plan value = plan value for month / number of days in month * number of days elapsed. If need be have the virtual KF return the ratio of number of days elapsed/number of days in the month
3. Now you can do the comparison assuming that the value of actuals will be till the current date and not beyond.
This is assuming that you can write a Virtual KF and the number of records is less enough to avoid any performance issues
Hope it helps..
Arun
Assign points if helpful
Message was edited by: Arun Varadarajan -
Hi All,
my scenario is polling data from one table and publishing in to jms queue. and I'am using FaultPolicies with retry (2) and interval time (2) and exponential Backoff-(3).
when I configured DB Poll, the properties of maxrows (4), attempts (9),Interval (1) and back off factor (2).
Now the requirement is to check after executing the faultpolicies, my DB properties should also process. For this I have given wrong JNDI in jms queue to test my service.
when i test the fault is executing through faultpolicies but DB properties are not retrying.
can anyone help me in this it would be appreciate.
Regards,
G.Satish.Quickly, please.
25% left. -
Hello Om help please its urgent
Hi there
1) What is the Difference between "Evaluation Paths and relationships "
2) How many cost centers can we assign to a org unit ?
3) What is difference between - Simple maintainence and Expert Mode
4) what could be a possible structure of a org unit, exg - if a organisation has branches in 34 countries and head quarters being in london, and having a work center or branch in bangalore, how do we relate sitting in banglaore to London mother company
5) how many Company codes can a company can have at a time ?
6) How can one know if a position is vacant or occupied in a company
7) Can a junior employee report to 4 different supervisors, if yes how ?
8) what is the difference between " Job and Position"
9) What are the infotypes in OM - Please this is important
10) What can a end user do in OM - if he can face a problem where can he face a problem ?? in regular intervals ?
REgards
Fahad8) to quote from SAP Help...
Positions are concrete and are held by persons in an enterprise (purchasing administrator, for example). Jobs, in contrast, are classifications of functions in an enterprise (administrator, for example), which are defined by the assignment of characteristics. Jobs serve as job descriptions, that apply to several positions with similar tasks or characteristics.
6)The Vacancies report (RPAPL010) generates a list of all existing vacancies, from which you can perform additional interactive functions (such as search for suitable applicants for a position, display a requirements profile, and so on
9) Infotype in OM start from HRP1000 thru' HRP1999 .. there are a few others like HRT*** & HRPAD***
~Suresh -
Need to update list page using a pop up dialog page (Please its URGENT)
Hi,
I have master page with list of employees. Using a pop up dialog I'am trying to insert a new record but the record is not appearing in the list.
Possible solutions tried but no hope:
1. Using managed bean I tried with refreshing (re-execute) the iterator and binding container of employee list page.
2. Used a navigation from popup dialog to list page along with returnActionListener associated on button.
Thanks in advance,
Syed FazalHi Syed,
you may try in your return event
FacesContext context = FacesContext.getCurrentInstance();
NavigationHandler nh = context.getApplication().getNavigationHandler();
nh.handleNavigation(context, null, "whateveryournavigationruleis"); -
Need simple example on parsley framework using FLex,Please its urgent
Hi,
I tried samples on parsley framework using samples like contactmanagement.But i didnt get any output and not able to debug.
Can u pls post any sample on this.This is an example I put together. It relies soley on the messaging functionality and is designed to be simple. Parsley has many tag (too many) and alternative approaches that you will find variations. However I had a hard time finding some beginner examples clearly explained.
Parsley MVC, RemoteObject, Zend AMF and MySQL Basic Flex Example -
Need query to convert Single Row Multiple Columns To Multiple rows
Hi,
I have a table with single row like below
Column0 | Column1 | Column2 | Column3 | Column4|
Value0 | Value1 | Value2 | Value3 | Value4 |
Am looking for a query to convert above table data to multiple rows having column name and its value in each row as shown below
Column0 | Value0
Column1 | Value1
Column2 | Value2
Column3 | Value3
Column4 | Value4
Thanks in advance.
MohanHi ykMohan,
Dynamic UNPIVOT can be applied in this case as well.
CREATE TABLE dbo.T(ID INT,Column0 VARCHAR(99),Column1 VARCHAR(99),Column2 VARCHAR(99),Column3 VARCHAR(99),Column4 VARCHAR(99))
INSERT INTO T VALUES
(1,'Value0','Value1','Value2','Value3','Value4'),
(2,'Value0','Value1','Value2','Value3','Value4');
DECLARE @columns VARCHAR(MAX)
SELECT @columns=
STUFF(
SELECT ','+ COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME ='T' AND TABLE_SCHEMA='dbo' AND Column_name NOT IN('ID') FOR XML PATH('')
),1,1,'')
DECLARE @Sql NVARCHAR(MAX)
SET @Sql =
'SELECT ID, UPT.col,UPT.val FROM T
UNPIVOT
(val FOR col IN('+@columns+')) AS UPT'
EXEC sp_executeSQL @Sql
DROP TABLE T
If you have any feedback on our support, you can click
here.
Eric Zhang
TechNet Community Support
Maybe you are looking for
-
i turn on my printer and it says that i need to remove and check my cartridges. i did that a million times and it still says that same message. i dont know what else to do. any suggestions??? also, i dont know where to get a connection for my labtop
-
Outlook 2010 has problems dealing with in-line attachment (not an Exchange issue!)
Hi all... Is there an official way to have this bug looked at? (Note -- it is *not* the Exchange/PDF bug that has been semi-addressed with the very-recentInterim Update for Exchange 2007...) If I set up Outlook 2010 to use an IMAP server account (no
-
Hello, I am trying to read a TDMS file in a Visual Studio C++ 2005 program. I downloaded the DLL from http://ni.intellisurvey.com/run/2007codelicenseagree and attempted to run the example program: readfile.c I got an error when attempting to open t
-
I purchased a book on Amazon and clicked it onto kindlecloud because I didn't see an ipad option. How do I get my book to my kindle app?
-
Sender JDBC.....pick data from table view?
Hi Experts, working on JDBC for first time, so have few questions. data base guys want to create a table view and we need to pick the data from table view. my question is can we import the structure form data view? if i am not able to import, so i ne