Trouble with the pivot and the columns that contain numbers/spaces
HelloI have trouble with the pivot statement.
How could I do this just for columns that are numbers?
How could I do this just for columns that contain spaces?
Can someone please help?
based on the documentation of Carsten Czarski
http://SQL-PLSQL-de.blogspot.com/2007/08/kreuztabellen-in-Oracle11g-SQL-pivot.html
essentially to help:
--------------------
Select deptno, sum (clerk), sum (salesman), sum (manager)
of (emp) pivot
Sum (SAL) of EMPLOYMENT
in ("CLERK" as a 'CLERK', 'SELLER' as 'SELLER', 'MANAGER' as 'MANAGER')
)
Deptno group
--------------------
DEPTNO SUM (CLERK) SUM (SALESMAN) SUM (MANAGER)
---------- ---------- ------------- ------------
30 950 5600 2850
20 1900 2975
10-1300-2450
I tried to run at my own table:
NAME MONAT WERT
-------------------------------------------------- ---------- ----------
5 Antarctica 404,84
Asia 7 106,41
Oceana 2 456,96
4 the Europe 426,23
9 Antarctic 537,56
Europe 9 832,58
The South America 12 662,41
Europe 4 422,27
America of the North 7 312,19
America of the North 10 148,92
10 selected lines.
But running:
--------------------
SELECT name, sum (1), sum (2), sum (3), sum (4), sum (5), sum (6), sum (7), sum (8), sum (9), sum (10), sum (11), sum (12)
(pivot) apex_wksp.demo_pivot2
Sum (Wert) for monat
in ('1 ', '2', ' 3', '4 ', '5', '6', '7',' 8 ', ' 9',' 10', ' 11 ', ' 12')
)
Group by name
;
--------------------
led to:
Antarctica 1 2 3 4 5 6 7 8 9 10 11 12
North America 1 2 3 4 5 6 7 8 9 10 11 12
Oceana 1 2 3 4 5 6 7 8 9 10 11 12
The South America 1 2 3 4 5 6 7 8 9 10 11 12
Europe 1 2 3 4 5 6 7 8 9 10 11 12
Asia 1 2 3 4 5 6 7 8 9 10 11 12
6 selected lines.
not quite what I expected.
In addition,
--------------------
Select monat, sum (Antarctica), sum (North America), sum (Oceana), sum (South America), sum (Europe), sum (Asia)
(pivot) apex_wksp.demo_pivot2
Sum (Wert) name
("Antarctic", "North America", "Oceana", "South America", "Europe", "Asia")
)
Group by name
;
---------------------
ORA 907 results
I know what the problem is - but how do I do it right?
using double quotes or replace (ing) space with just underscores seems to garble sql for the unreadable.
Help, please.
Thanks in advance,
Michael Weinberger
Attention to the rotated default column alias:
SQL> with demo_pivot2 as (
2 select 'Antarctica' name,5 monat,404.84 wert from dual union all
3 select 'Asia',7,106.41 from dual union all
4 select 'Oceana',2,456.96 from dual union all
5 select 'Europe',4,426.23 from dual union all
6 select 'Antarctica',9,537.56 from dual union all
7 select 'Europe',9,832.58 from dual union all
8 select 'South America',12,662.41 from dual union all
9 select 'Europe',4,422.27 from dual union all
10 select 'North America',7,312.19 from dual union all
11 select 'North America',10,148.92 from dual
12 )
13 select name, sum("'1'"),sum("'2'"),sum("'3'"),sum("'4'"),sum("'5'"),sum("'6'"),sum("'7'"),sum("'8'"),sum("'9'"),sum("'10'"),sum("'11'"),sum("'12'")
14 from demo_pivot2 PIVOT (
15 sum(wert) for monat
16 in ('1','2','3','4','5','6','7','8','9','10','11','12')
17 )
18 group by name
19 ;
NAME SUM("'1'") SUM("'2'") SUM("'3'") SUM("'4'") SUM("'5'") SUM("'6'") SUM("'7'") SUM("'8'") SUM("'9'") SUM("'10'") SUM("'11'") SUM("'12'")
------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------- ----------- -----------
Antarctica 404.84 537.56
North America 312.19 148.92
Oceana 456.96
South America 662.41
Europe 848.5 832.58
Asia 106.41
6 rows selected.
SQL>
SY.
Tags: Database
Similar Questions
-
The keyboard of my laptop does not work correctly.
I have somehow turned the keys of the calculator and when I try to type with the keys that have numbers on them, I have numbers instead of letters. Does anyone know how to disable this option?
I use a laptop with a wireless keyboard to send this message, but want to use my laptop keyboard.Help!Hi newsgirl,.
Somewhere at the top of the laptop keyboard is a key that says Num Lock (or Num Lk or something like that). It can be accessed directly, or you may need to press a key to access (or some other keys). In any case, you must click this to turn off the number lock because it is what causes the problem. This key is usually used on laptops to create a section of a regular keyboard that can act as the normal keyboard calculator keypad (for those who need that, like accountants or persons who need to enter strings of numbers). Once you turn it off, you will be fine as the keyboard returns to normal.
I hlpe that aid.
Good luck!
-
a bug with the structure that contains bit fields?
using CVI 8.5. I tried to set up a structure that contains bit fields. Although the structure compiles, I encounter strange behavior when you access individual fields, while the value of the overall structure seems ok. Here is the structure:
typedef struct
{
Union
{
struct
{
unsigned int Flag1: 1;
unsigned int dummy: 3;
unsigned int Flag2: 4;
unsigned int Indicateur3: 4;
unsigned int dummy2: 4;
};
unsigned short;
} flags;
} flagset;When you set the Member 'all' to a value so that one or more indicators, but not all, are false, I still read the individual like real flags, until all flags are set to false.
I missed something? This definition is really legal?
Please find attached a file showing the problem.
The same issue is at stake with or without the ternary operator. It turns out the problem was not specifically with printf, but rather a bug in the compiler that is related to the evaluation of the members of anonymous internal structures. If several internal anonymous struct members are evaluated before the compiler actually do anything with the result - which is the case when passing arguments to a function-, so they will all be evaluates the value that was evaluated last.
A. Mert
National Instruments
-
Import excel 2003 and 2007 files that contains numbers and text in LabVIEW
Hello
I try to import *.xlsx files (2007) containing numbers and text in LabVIEW and som *.xls (2003), but I can't make it work. First column with the text and the second with numbers.
Can someone help me with a small example? Is there an easy way?
FYI
I have access to all packages and addons for LabVIEW through my work (University)
Best regards
Simon
There is an example usage of the reporting tool.
http://decibel.NI.com/content/docs/doc-4965
It should give you a starting point.
I hope this helps.
-
How to write a query to return rows with the varchar column that contains even a single occurrence of the characters, such as Ÿ and
I have a table whose columns with values such as
MINNEAŸPOLIS and ¿VV ¿A
Only the characters that are allowed in this column are alphabets, numbers, spaces, points and supports.
Please help to write a SQL SELECT with Regexp_like query or any other option.
Thanks to you all! Under query worked for me. Thank you Frank to explain the concept of hooks inside regexp_like.
SELECT * FROM testspecial, WHERE REGEXP_LIKE (sampletext, "[^] ^ A - Z ^ a - z ^ 0-9 ^ [^.]") ^ {^} ^]') ;
-
I bought TurboTax and downloaded, but can I have downloaded previously because I was unable to install due to the previous installation. After that 2 hours of phone support with TurboTax including screenshare, they stated that the problem lies in the registry. It was damaged and I had to reinstall my OS.
What happens when you reinstal XP OS with the cd that takes me to service pack 2 and I'm at SP3?
I finally found my OS reinstall CD, but it's waaaay above my comfort level... what I do now.
Frankly, if TurboTax is causing this much trouble, I would use another company as the income tax act.
Of course, you can reinstall Windows. It's a shame, if that's the only way to solve this problem. :-(For later use, it is sometimes necessary to download the installation file, physically disconnect from the Internet, set up a clean boot (using msconfig startup diagnosis), reboot and THEN install the large program (and then undo the clean boot, reboot and re-connect to the Internet). -
OK, I make playlists for radio broadcast. I need to change the columns shown, and it has always been easy. The playlist I created just has a different view, and there seems to be no way for me to change the columns that are visible. Any ideas?
Click Show main menu, and then click Show the Options. You can select the columns that you want or do not want to here.
See you soon,.
GB
-
You need to reset and or change my old iCloud account of moms on the phone with another. When I try to reset it with the information that we know that it says "blocked account"
ACCOUNT SAFETY CONTACT NUMBERS
-
I tried to log in with the password that I had for years and now it says its wrong. I have reset the password without the disc? I am trying to renew new internet protection and it wont let me because I need to approve it.
Thank you
If you want to tell your Windows 7 user password, see guide to recovering lost passwords or other defects preventing log on Windows 7 Home Premium
-
Hello, I recently bought a new iMac and I am wanting to install Lightroom for her, but I'm having some trouble with the key to series is not recognized. There is no disk drive on the new iMac, so I can't blow my disc. Is there a way I can download it simply by using the key to series on my package? I tried the section "Redeem Code", but said air key is not valid. Thank you
Download & install instructions https://forums.adobe.com/thread/2003339 can help
-includes a way to go to a page to download the Adobe programs if you do not have a disk or drive
-Cloud desktop http://helpx.adobe.com/creative-cloud/help/creative-cloud-desktop.html
-Cloud Getting Started https://helpx.adobe.com/creative-cloud.html
-you will need to enter your original serial number during the installation for non-Cloud programs
- or kglad links in response to #1 here can help https://forums.adobe.com/thread/2081216
Also go to https://forums.adobe.com/community/creative_cloud/creative_cloud_faq
-
I recently had to rebuild the computer and reinstalled the photos. I have photos imported into Lightroom, but the parameters associated with the photos, that is to say. When they were developed, are not there. How to import these?
Default LR stores all changes in the catalog file, not in the pictures. So if you have a backup of your original catalog you will need to copy on the newly rebuilt system and open it in LR. You will then need to recreate a link to the images in the catalog depending on where are your images and where the original LR catalogue think they are.
-
How do I monitor/find where is the State of my download? I don't know how long it takes or if there is a problem with the download that I can't find anything. Also, is it supposed to be an icon for my purchase of Photoshop and light in my apps folder? Where can I find that when it's done download?
Could you please confirm the operating system you are using.
You can see the status of the application of CC desktop download.
The CC app desktop click the creative cloud icon located in the taskbar (Windows) or the Apple bar (Mac OS) menu, to open the creative cloud desktop application.
Hope this will help you.
Kind regards
Hervé Khare
-
I have Acrobat Pro on my computer and I work with the drawing that have been digitized in PDF format. The scanners are not aligned or place because of the poor scanning process. Is there anyway to align the document even if it requires me to crop or lose some on the edges?
Hi brad.
Yes. You can use the analysis tools to straighten and crop your document. Here is a link to a new tutorial. The key to activate the sliding options recovery is to choose the option of the camera Image in the drop to Enhance, and gives you tools to set the correct page for smoothing areas.
Donna.
-
I have Adobe Reader XI with the package that allows me to send a PDF file and convert PDF files to Word. When I open a pdf file and you try to find the search shows no match, even if the word I'm looking for is in the document. Suggestions how to search?
A scanned document is an image; You can't find a picture.
If the image contains text, recognition of characters (OCR) will convert the 'text' in the image in real text (searchable, editable).
OCR can be performed automatically when converting a PDF to Word, using the ExportPDF service.
To run OCR inline in a PDF document, you will need Acrobat.
-
I have a table of the adf, I added a column that contains a button that I created, when I click it must remove this row in the table, but it is not, please help
I don't understand. You use vo and eo for you to use business components.
Again, this kind of code call in trouble.
You must post the changes to make them visible to the eo find vo. You must then run the query for the changes in the business layer strips then you must update the iterator he table is based on.
In your code I see that happen, hooch maybe because it is more often than not formatted and undocumented.
My advice is to do a small test case that you can manage with easy sql. Once you get it to run transfer you the results to the actual application.
Timo
Maybe you are looking for
-
The Tablet/mouse scroll function does not work for the other tabs when a PDF file is opened.
-
I am trying to view my fafsa on the web, and he continues to say "my browser not support detected." I have windows 7 and my Mozilla is 8.0
-
I replaced the color ink cartridge before receiving these problems. I have checked to make sure all was well, but don't know what else to try.
-
When I'm on the internet and want to send a link, there is no an option "send icon.
Some how in the last weeks, the send option has disappeared off the coast of my toolbar when I'm in Internet Explorer. I looked everywhere. Help. PLEASE
-
Router is not connecting to the modem so I can't get internet
All right-_ - I tried a lot of things with this so I get irritated sorry. Here is my info I have a Linksys Wireless Router with SpeedBoost Firmware Version 7.2 WRT54GS (latest version). I'm trying to use it with a Sprint 645 series Modem. My IP addre