Transpose a single row of (definition, value) pairs in 2 columns
I need to convert or turn a result monkey of a row in a table 2 (alias) manual column headers.
Table
ID | Description | Option1 Desc | value of option 1 | Option 2 Desc | value of option 2 | Option3 Desc | value of option3 | Option4 Desc | Option4 value | |
---|---|---|---|---|---|---|---|---|---|---|
1 | Seller - Lang - Menutype | Seller - Lang - Opt1 | Value1 | Seller - Lang - Opt2 | Value2 | Seller - Lang - Opt3 | Value3 | Seller - Lang - Opt4 | Value4 |
My current table has 8 options in total, but this should be enough.
My select statement can make me what I want if poster horizontally that I missing just the knowledge necessary to transpose.
Menu option | Value | Menu option | Value | Menu option | Value | Menu option | Value |
---|---|---|---|---|---|---|---|
Seller - Lang - Opt1 | Value1 | Seller - Lang - Opt2 | Value2 | Seller - Lang - Opt3 | Value3 | Seller - Lang - Opt4 | Value4 |
I have to post this and I really need a query.
Menu option | Value |
---|---|
Seller - Lang - Opt1 | Value1 |
Seller - Lang - Opt2 | Value2 |
Seller - Lang - Opt3 | Value3 |
Seller - Lang - Opt4 | Value4 |
Hello
It's called Unpivoting, and here's a way to do it:
SELECT menu_option, value
FROM table_x
UNPIVOT (menu_option, value)
COLLAR IN ((option1_desc, option1_value))
(option2_desc, option2_value)
(option3_desc, option3_value)
(option4_desc, option4_value)
)
;
If you would care to CREATE States TABLE and INSERT post for your sample data, then I could test it.
Tags: Database
Similar Questions
-
10g TRANSPOSE a single ROW/columns in ROWS/columns
Hello
I have a query that returns a single row with 4 columns
I need output in a single line by column
Here is a table of test;
the output current is;CREATE TABLE TEST ( SEQ VARCHAR2(10), FT DATE, CD DATE, DELTA NUMBER(10) ); INSERT INTO TEST (SEQ, FT, CD, DELTA) VALUES ('1111',SYSDATE-1,SYSDATE,1); SET NUM 999; SELECT SEQ, FT, CD, DELTA FROM TEST; DROP TABLE TEST;
and want;SEQ FT CD DELTA ---------- ------------------------- ------------------------- ---------------------- 1111 09-AUG-10 10-AUG-10 1
SEQ 1111 FT 09-AUG-10 CD 10-AUG-10 DELTA 1
SQL> ed Wrote file afiedt.buf 1 select regexp_substr(str,'[^,]+',1,level) 2 from 3 ( 4 SELECT SEQ||','|| FT||','||CD||','||DELTA str FROM TEST25 5 ) 6* connect by level <= length(str) - length(replace(str,','))+1 SQL> / REGEXP_SUBSTR(STR,'[^,]+',1,LEVEL) ----------------------------------------------------------------------- 1111 09-AUG-10 10-AUG-10 1
-
APEX 5, universal theme, value pairs attribute - column layout problem
Hello
APEX 5, universal theme.
I have a little problem with the column model attribute - value pairs.
If one of the fields is the result of a LOV and the value of the field is zero the provision goes a little wrong (half a row of the value column), when having long lists of pairs, it is difficult to see what value belongs to what field. It is a horizontal allignment problem that looks like the below example, the field in the middle is an empty field based on a LOV.
Think of it as a little bug. Maybe someone can provide an easy solution?
See you soon,.
Bottom
It looks like a bug in the CSS of the theme. This rule
.t-AVPList-label, .t-AVPList-value { display: block; vertical-align: top; font-size: 1.4rem; line-height: 2rem; padding: .8rem 1.2rem; margin: 0; box-shadow: 0 1px rgba(0,0,0,.05) inset; transition: background-color .1s; }
needs a property added minimum height so that the heights of term/description elements are aligned if one (or both) of them are empty:
.t-AVPList-label, .t-AVPList-value { display: block; vertical-align: top; font-size: 1.4rem; line-height: 2rem; padding: .8rem 1.2rem; margin: 0; box-shadow: 0 1px rgba(0,0,0,.05) inset; transition: background-color .1s; min-height: 4rem; }
You can create a style sheet personalized containing a rule of precedence for this problem:
.t-AVPList-label, .t-AVPList-value { min-height: 4rem; }
Transfer it to your workspace and reference it in the theme CSS File URL property to include in the app:
#THEME_IMAGES#css/Core#MIN#.css?v=#APEX_VERSION# #WORKSPACE_IMAGES#theme_42_AVPlist_fix.css
-
What is the best way to move with esx3.5 vmtools key/value pairs?
Hello
I found both candidates to store the key/value pairs for a vmware client. My ultimate goal is to run a process on the VC box that updates these data, and then read through the software tools of vm on the host (somehow) were invited.
The first method is through 'guestinfo' settings which can be adjusted in four ways:
Add the variable of the vmx fileprompt.
Set the variable manually on the client (using vmwareservice.exe - cmd "infoset");
using vmware-cmd (vmware-cmd & lt; vm-cfg-path & gt; setguestinfo & lt; variable & gt; & lt; value & gt;)
the use of vmcom.dll COM objects (seems to be deprecated in ESX 3.5)
These variables are easily accessible on the client by running vmwareservice.exe - cmd 'info-get guestinfo.variablename '. However, I cannot find a convenient way (better based on powershell) of their definition of a scheduled task or service to VC area.The second method is the customfields of guests in VItoolkit property, which can be defined as follows:
get - vm MyVMName | Game-CustomField-nameOfValue name-value DataToBeStored
Unfortunately, I am unable to access these data in the comments, and indeed I do not know if this is possible. If this isn't the case, I guess my only recourse would be to write a tool to connect to Web services on the VC box with a low privilege account. I prefer not to do this because it means the network infrastructure implementation to point the guest to the right VC, development of custom etc permissions...So, my questions are:
Is it possible to define variables of guestinfo through VI Toolbox, running on the virtual circuit?
Is it possible to read customfields on the client, through the vmtools?
Or is there another method to make this key/value data exchange?
You can add/edit entries in the VMX file like this
$vm = get-vm
| Get-View $vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec $vmConfigSpec.extraconfig += New-Object VMware.Vim.optionvalue $vmConfigSpec.extraconfig[0].Key= "guestinfo" $vmConfigSpec.extraconfig[0].Value = "whatever" $vm.ReconfigVM($vmConfigSpec) -
The drop-down list schema lists (with the name/value pairs)
Hello
I'm looking for more information on creating a schema type definition that LiveCycle Designer ES will fill (fill in the name and value) of drop-down lists. For example, I have something like:
< xsd:simpleType name = "RoleTypeCodeType" >
< xsd:restriction base = "xsd:token" >
< value xsd: Enumeration = 'ABC' >
< xsd: annotation >
< xsd: documentation >
Aboriginal community
< / xsd: documentation >
< / xsd: annotation >
< / xsd: Enumeration >
< value xsd: Enumeration = "ADJ" >
< xsd: annotation >
< xsd: documentation > referee < / xsd: documentation >
< / xsd: annotation >
< / xsd: Enumeration >
...< xsd:minLength value = "1" > < / xsd:minLength >
< xsd:maxLength value = "3" > < / xsd:maxLength >
< / xsd:restriction >
< / xsd:simpleType >This creates a list. I can bind this to a list field. However, of course, when I saw the pdf, my drop down list items in this area are just the three-letter code. I would get the descriptions associated with these articles (as shown on the connection tab) to be filled. The end result is that my list see 'Indigenous community', 'referee', etc. and when selected, return 'ABC', 'ADJ' in the XML during export.
If list under the connection tab items are filled manually then this export works correctly. However, the list is generated during execution and dynamic. So nobody knows what the schema definition must be for the field in the list on the LiveCycle form to create the name-value pairs?
Thank you
John
Hi John,.
You will need to incorporate the schema, but you can reference the imported schema as they get integrated as well (there a bug in the designer when they were not integrated, but I think it crept in 8.0).
In any case to refer to the imported schema you will need to loop though all schemas
var
schemas = xfa.resolveNodes('schema[*]');
Will give it refers to all schemas, the fine loop them;
for
(var schemaIndex = 0; schemaIndex< schemas.length;="">
So if these patterns have an id attribute (I don't think that you can refer to namespace attributes) test the value of the id;
If
(schema.@id is "whateveryourschemaidis")
If there is no attribute ID and you cannot add a you might have to search for the type in each scheme, something like;
var roleTypeCodeType is schema.xsd::simpleType. (@name is "roleTypeCodeType");
If (roleTypeCodeType! == undefined)
{
... load the values of the annotation.
}
Hope that helps but if you if you can post your schema (and it's imports), I could understand exactly the problem.
Bruce
-
My iPhone6s pairs with ONE single device (phone link2cell). will pair with something else. At the opening of the Bluetooth window "bicycle wheel" next to "Other devices" is always running as if the search! Any suggestions?
When you open the Bluetooth section in the settings, you can still see the spinning wheel, because it is in discovery mode and is actually looking for other devices in the range. Other devices must be in discovery/torque for the device mode to find them. However, I'm not sure you can be associated with multiple devices at the same time with the iPhone. You can have multiple devices matched on the phone, but you can always not more than one partner at the same time. It depends on what it is you are trying to pair.
-
Retrieves an array of flattened JSON name/value pairs
Hello
I have a JSON string that contains a table of name/value pairs:
{"params": []}
{'name': 'Param1', 'value': '10'},
{'name': 'Param2', 'value': '20'}
]
}
For now I'm extracting the entire table by iterating on the index in the array until an error is generated, as shown in the image below.
It is not very pleasant, because it always generates an error (could be ignored) and also in the resulting table, at the end, an element empty.
Is there an easier way to achieve this?
OK, found the solution myself.
Simply omit the path and enter a cluster with a table named ("params") of clusters containing a 'name' and 'value' constant.
-
Hello! Invite please, if you can programmatically create compliance fumes graphic value 3D (Position - value) pairs.
Or probably do that manually through 3D graphics properties?
-
Don't forget to call with several key-value pairs
I'm looking to invoke the application Remember and I try to send a title and a due date. The problem is that I don't know the format for sending multiple data items. Can someone help me with the format what should I use to having an remember entry created with a title and a due date?
function invokeRemember (someTitle, someDate) {}
BlackBerry.Invoke.Invoke ({}
target: "sys.pim.remember.composer."
Action: "bb.action.ADD."
URI: "remember://notebookentry?title=" + someTitle + '& duedate =' + someDate;
(}, onInvokeSuccess, onInvokeError);
}I think "Ivoking Basic Applications" page shows how to do this: https://developer.blackberry.com/html5/documentation/remember.html
It looks like you can send the following in the field of the URI:
You can also add the following key-value pairs by adding a question mark (?) after the URI: title=
description= duedate=<# SECONDS SINCE EPOCH> status=NotActionable, Completed, NotCompleted notebookid= : tags= -
HI friends,
is there any collection class that support name, value pair format
as Basicnmaevaluepair in andriod, so that we can seprate name and value string and use.
Hi friends,
customize this thing and my offer is resolved.
-
Single - row subquery returns more than one line.
Hi Experts
I am faced with error
ORA-01427: single - row subquery returns more than one line.
MyQuery is:
select TO_CHAR(T.MR_REG_DATE,'DD') "DATE" ,CASE WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) between 0 and 1 THEN ' 01'||' - ('||'0 - 1 Month)' WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) BETWEEN 2 AND 12 THEN ' 02'||' - ('||'2 - 12 Months)' WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) BETWEEN 13 AND 60 THEN ' 03'||' - ('||'1 - 5 Years)' WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) BETWEEN 61 AND 120 THEN ' 04'||' - ('||'5 - 10 Years)' WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) > 120 then ' 05'||' - ('||'> 10 Years)' END age ,count(T.Mr_Code) No_of_Patient ,( SELECT count(x.mr_code) mr_code FROM HMIS_MRINFO X where X.mr_reg_date between &FRM_DATE AND &TO_DATE and X.mr_code NOT in (select Y.mr_code from hmis_pat_add_dis_detail Y WHERE Y.mr_reg_date between &FRM_DATE AND &TO_DATE ) GROUP BY CASE WHEN trunc((MONTHS_BETWEEN(X.MR_REG_DATE,X.MR_DOB))) between 0 and 1 THEN ' 01'||' - ('||'0 - 1 Month)' WHEN trunc((MONTHS_BETWEEN(X.MR_REG_DATE,X.MR_DOB))) BETWEEN 2 AND 12 THEN ' 02'||' - ('||'2 - 12 Months)' WHEN trunc((MONTHS_BETWEEN(X.MR_REG_DATE,X.MR_DOB))) BETWEEN 13 AND 60 THEN ' 03'||' - ('||'1 - 5 Years)' WHEN trunc((MONTHS_BETWEEN(X.MR_REG_DATE,X.MR_DOB))) BETWEEN 61 AND 120 THEN ' 04'||' - ('||'5 - 10 Years)' WHEN trunc((MONTHS_BETWEEN(X.MR_REG_DATE,X.MR_DOB))) > 120 then ' 05'||' - ('||'> 10 Years)' END ) Missing_MR from hmis_mrinfo T,hmis_pat_add_dis_detail M where T.mr_code = M.mr_code(+) and T.mr_reg_date between &FRM_DATE AND &TO_DATE &AGE_GRP GROUP BY T.MR_REG_DATE ,CASE WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) between 0 and 1 THEN ' 01'||' - ('||'0 - 1 Month)' WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) BETWEEN 2 AND 12 THEN ' 02'||' - ('||'2 - 12 Months)' WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) BETWEEN 13 AND 60 THEN ' 03'||' - ('||'1 - 5 Years)' WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) BETWEEN 61 AND 120 THEN ' 04'||' - ('||'5 - 10 Years)' WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) > 120 then ' 05'||' - ('||'> 10 Years)' END ORDER BY T.MR_REG_DATE;
Please give some advice / solution.
I think this might do it for you
Select
TO_CHAR (T.MR_REG_DATE, 'DD') "DATE."
CASE
WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) between 0 and 1 THEN ' 01' |'. - ('||' 0-1 month)"
WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) BETWEEN 2 AND 12 THEN ' 02' |'. - ('||' 2-12 months)"
WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) BETWEEN 13 AND 60 THEN ' 03' |'. - ('||' 1-5 years)"
WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) BETWEEN 61 AND 120 THEN ' 04' |'. - ('||' 5-10 years)'
WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) > 120 then ' 05' |'. ' - ('| ' > 10 years).
Age of the END
count (T.Mr_Code) No_of_Patient
, count (case when t.mr_code NOT in (select Y.mr_code from hmis_pat_add_dis_detail Y))
WHERE Y.mr_reg_date between & FRM_DATE AND & TO_DATE)
then t.mr_code
(end) Missing_MR
of hmis_mrinfo T, hmis_pat_add_dis_detail M
where T.mr_code = M.mr_code (+)
and between T.mr_reg_date & FRM_DATE AND & TO_DATE
& AGE_GRP
T.MR_REG_DATE GROUP
CASE
WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) between 0 and 1 THEN ' 01' |'. - ('||' 0-1 month)"
WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) BETWEEN 2 AND 12 THEN ' 02' |'. - ('||' 2-12 months)"
WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) BETWEEN 13 AND 60 THEN ' 03' |'. - ('||' 1-5 years)"
WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) BETWEEN 61 AND 120 THEN ' 04' |'. - ('||' 5-10 years)'
WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) > 120 then ' 05' |'. ' - ('| ' > 10 years).
END
ORDER BY T.MR_REG_DATE;
-
Request to remove row where the value of column contains alphabets
Hello
Could someone please help me to get this application working.
Request to remove row where the value of column contains alphabets.
DELETE FROM BIN_ITEM WHERE order_nmb LIKE '% [A - Z] % ' | LIKE '% [a - z] %'
Thank you and best regards,
Madam.
SELECT order_nmb FROM BIN_ITEM WHERE regexp_count(order_nmb,'[0-9]') = 0
----
Ramin Hashimzade
-
Hi all
Is there a programmatic way to Exchange data (of the key-value pairs) with the guest OS?
We have an application that runs inside comments, and we want that this application in order to use this mechanism to Exchange data. At this point, the guest have no network connectivity. One thing that might work for us is to use the registry to the guest operating system. But I'm not sure how to handle the registry of the guest operating system.
We looked in the VirtualMachineConfigInfo.extraConfig property, but these key-value pairs are not accessible from the comments (at least this is what I know)
any ideas?
Thank you
Onur
I think that it is better to use an environment variable or file to Exchange data with the guest operating system.
http://www.doublecloud.org/2012/03/set-environment-variables-in-guest-operating-system-on-VMware/
http://www.doublecloud.org/2012/03/read-environment-variables-in-guest-operating-system-on-VMware/
If you really want the registry value,
http://www.doublecloud.org/2012/02/run-program-in-guest-operating-system-on-VMware/
http://en.Wikipedia.org/wiki/Windows_Registry#Command_line_editing
Good luck!
Steve, author of the Open Source, VMware VI and vSphere SDK VI Java API
-
To access the inside loops key/value pairs
According to the docs of Shopify, liquid allows access to key/value pairs in
{% for item in hash %} {{point [0]}}: {{point [1]}} {% endfor %}for
loops, as follows:This does not work in the liquid renderer in British Colombia; the output of the key/value tags are empty. Here is an example of using the always available
{ ... {"urlculture": {"ModuleName": "urlculture", "culture": "EN"},...}this.urlculture
global object:{% for obj in this.urlculture %}
{{ obj | json }}
Key: {{obj [0]}}
Value: {{obj [1]}}
{% endfor %}This is the result I get:
{ "Key": "moduleName", "Value": "urlculture" } Key: Value: { "Key": "culture", "Value": "EN" } Key: Value:
Access by name (such as
{{ obj.Key }}
) also fails.Am I missing something, or is this all just not yet implemented?
Also, why isn't the nice formatting illustrated in this visible post editor in the current post code?
Thank you, Robert.
This was a great find. And you'll be happy to learn that we have set and it will work in the next version (unfortunately the hotfix does not update today, we have deployed on the beta version).
You will then be able to do things like:
{% for getParam in globals.get %} {{getParam[0]}} = '{{getParam[1]}}'
{% endfor %}-Lucian
-
Aggregate XML columns in a single row in Oracle
Hello
I have a table named TMTABLE HT and it followed columns:
ID, NAME, TEXT
1 orders XML1
2 orders XML2
3 orders for XML3
where XML1, XML2 and XML3 follow:
XML1:
<? XML version = "1.0" encoding = "utf-8"? >
The <>rowsets
rowset <>
< row >
< Uom IN. = "" > < DB > 4500005146
< Uom of line = "" > 10 < / Line >
< / row >
< / lines >
< / sets of lines >
XML2:
<? XML version = "1.0" encoding = "utf-8"? >
The <>rowsets
rowset <>
< row >
< Uom IN. = "" > < DB > 4500005147
< Uom of line = "" > 10 < / Line >
< / row >
< / lines >
< / sets of lines >
XML3:
<? XML version = "1.0" encoding = "utf-8"? >
The <>rowsets
rowset <>
< row >
< Uom IN. = "" > < DB > 4500005148
< Uom of line = "" > 10 < / Line >
< / row >
< / lines >
< / sets of lines >
Now, I want to query Oracle get this XML1, XML2 and XML3 in a single row, in the following format:
<? XML version = "1.0" encoding = "utf-8"? >
rowset <>
< row >
< Uom IN. = "" > < DB > 4500005146
< Uom of line = "" > 10 < / Line >
< / row >
< row >
< Uom IN. = "" > < DB > 4500005147
< Uom of line = "" > 10 < / Line >
< / row >
< row >
< Uom IN. = "" > < DB > 4500005148
< Uom of line = "" > 10 < / Line >
< / row >
< / lines >
I tried various queries, but not able to do this. Can someone help me please how to do in this regard?Hello
Assuming that TEXT column of XMLType data type:
SQL> select xmlelement("Rowset", 2 xmlagg(x.column_value) 3 ) as result 4 from tmtable t 5 , xmltable('/Rowsets/Rowset/Row' passing t.text) x 6 ; RESULT --------------------------------------------------------------------------------
4500005146 10 4500005147 10 4500005148 10
Maybe you are looking for
-
I can't seem to make the tour of the following pop up: "to use the"java"command line tool, you must install JDK. I downloaded Java for many times, but the pop-up Guard reappear. Is there any solution to get rid of this pop up, it makes me crazy? H
-
Can not go beyond "Windows Boot Manager".
The following message appeared after restarting my computer (Toshiba Satellite A200 1V0) from a window vista update Windows could not start. A recent hardwre or software change might be the cause.To solve the problem.1. Insert your windows installati
-
glReadPixels break when it is used from an application of Cascades?
I'm trying to use Cascades of glReadPixels() of the OpenGL ES 2.0 active app. Unfortunately, it crashes. If I use glReadPixels() from within the native SDK model OpenGL ES 2.0 than the QDE creates (no Cascades/natives only), it works. But, if I use
-
When activation Adobe widows professional version I get the invalid license number
Why I get a serial number incorrect when activating my copy of pro9 Acrobat? We replaced our old computers and the software needed.
-
Just bought X1C and did a clean install of W8 Pro and am having a problem with the trackpad. Specifically, I can't reverse the direction of scrolling. I tried reinstalling the drivers, checking the settings several times even, he continues to scroll