pivot query question
I have a query in Oracle 11: select to_char(da,'DY-DD') days
from (
select rownum -1 + to_date('2012-10-15','yyyy-mm-dd') da, l
from (select level l
from dual connect by level <= to_date('2012-10-21','yyyy-mm-dd') - to_date('2012-10-15','yyyy-mm-dd')+1)
order by 1)
Result"DAYS"
MON-15
TUE-16
WED-17
THU-18
FRI-19
SAT-20
SUN-21
What I need which is present in a row instead of a column: MON-15 TUE-16 WED-17 THU-18 FRI-19 SAT-20 SUN-21
This should be done with pivot requests? Any suggestion please!Thanks in advance.
Hello
user564819 wrote:
I need in 7 different columns.
Oracle version is 11.2.0.1.0. Could you give an example of how to do this with pivot query?
Here's one way:
WITH all_days AS
(
SELECT LEVEL AS n
, TO_CHAR ( TO_DATE ('2012-10-15','yyyy-mm-dd') + LEVEL - 1
, 'DY-DD'
) AS dy_dd
FROM dual
CONNECT BY LEVEL <= TO_DATE ('2012-10-21','yyyy-mm-dd') + 1
- TO_DATE ('2012-10-15','yyyy-mm-dd')
)
SELECT *
FROM all_days
PIVOT ( MIN (dy_dd)
FOR n IN ( 1 AS col_1
, 2 AS col_2
, 3 AS col_3
, 4 AS col_4
, 5 AS col_5
, 6 AS col_6
, 7 AS col_7
, 8 AS col_8
, 9 AS col_9
, 10 AS col_10
)
)
;
This always displays exactly 10 columns.
If the subquery produces less than 10 dates, then the last columns will be NULL.
If the subquery produces more than 10 dates, will be not shown the 11th (and later versions).
There is nothing special about the number 10; You can have any number of columns you want. The number of columns and their names is fixed when you write the query, regardless of what is in the subquery. If you want a dynamic number of columns, or names derived from data, see {message identifier: = 3527823}
Tags: Database
Similar Questions
-
I'm new to PIVOT queries. I was making reference to the discussion that follows, but ran into a problem.
When I added the XML to format data, I started to have NULL values rather than what I was looking for.
WITH (AS PIVOT_DATA)
SELECT * FROM)
SELECT THE REGION, FCST_PERIOD, PRIME_PART, FINAL_FORECAST
OF XYZ WHERE FCST_PERIOD > = last_day (trunc (sysdate)) + 1 and FCST_PERIOD < = last_day (add_months(sysdate,12)) AND PRIME_PART IN ('BLAH')
)
PIVOT XML (SUM (FINAL_FORECAST) FOR FCST_PERIOD IN (SELECT DISTINCT FCST_PERIOD OF XYZ))
)
SELECT PRIME_PART, REGION,
EXTRACTVALUE(FCST_PERIOD_XML,'/PIVOTSET/ITEM[1]/COLUMN[2]') FCST_PERIOD1,
EXTRACTVALUE(FCST_PERIOD_XML,'/PIVOTSET/ITEM[2]/COLUMN[2]') FCST_PERIOD2,
EXTRACTVALUE(FCST_PERIOD_XML,'/PIVOTSET/ITEM[3]/COLUMN[2]') FCST_PERIOD3
OF PIVOT_DATA;
RESULTS IN:
PRIME_PART REGION FCST_PERIOD1 FCST_PERIOD2 FCST_PERIOD3 BLA MIDWEST (NULL) (NULL) (NULL) BLA WEST-NV (NULL) (NULL) (NULL) BLA SOUTH-EAST (NULL) (NULL) (NULL) BLA WEST-CA (NULL) (NULL) (NULL) BLA SOUTHWEST (NULL) (NULL) (NULL) BLA EAST (NULL) (NULL) (NULL) The second part of my question is how would I do a group when you use a pivot query. When I finished, I've has several parts and would like to group by REGION.
Thank you!
Names of elements and attributes in XML are case-sensitive.
Try with:
EXTRACTVALUE (FCST_PERIOD_XML, ' / PivotSet/item [1] /column [2]') FCST_PERIOD1
There is also a good chance that EXTRACTVALUE is frowned upon in your version. Instead, use XMLQuery or XMLTable.
That being said, using XML PIVOT just to grind it later into a number known columns is pretty useless.
The same can be achieved much more efficiently with regular PIVOT operator (and if necessary analytical function).
Post some examples of data in the table of your database and your final result expected to get useful assistance.
-
Hi all
I wrote a pivot query but it is not giving me the expected output.
with test as ( select 'outgoing' type_of_call, 'local' sub_type_call, '1sec' pulse, 0.3 call_charge from dual union all select 'outgoing' type_of_call, 'STD' sub_type_call, '2sec' pulse, 1.5 call_charge from dual union all select 'outgoing' type_of_call, 'ISD' sub_type_call, '1sec' pulse, 4 call_charge from dual union all select 'SMS' type_of_call, 'local' sub_type_call, '1' pulse, 0.5 call_charge from dual union all select 'SMS' type_of_call, 'STD' sub_type_call, '1' pulse, 1 call_charge from dual union all select 'SMS' type_of_call, 'ISD' sub_type_call, '1' pulse, 3 call_charge from dual ) select * from test pivot(count(type_of_call) for (sub_type_call) in ('local','STD','ISD') ); O/P should look like Type_of_call pulse_local charge_local Pulse_STD charge_STD pulse_ISD charge_isd outgoing 1sec 0.3 2sec 1.5 1sec 4 SMS 1 0.5 1 1 1 3
Is there something that I am missing in the query?
Thank you
SID
SQL> with test as ( select 'outgoing' type_of_call, 'local' sub_ty, '1sec' pulse, 0.3 call_charge from dual union all select 'outgoing' type_of_call, 'STD' sub_ty, '2sec' pulse, 1.5 call_charge from dual union all select 'outgoing' type_of_call, 'ISD' sub_ty, '1sec' pulse, 4 call_charge from dual union all select 'SMS' type_of_call, 'local' sub_ty, '1' pulse, 0.5 call_charge from dual union all select 'SMS' type_of_call, 'STD' sub_ty, '1' pulse, 1 call_charge from dual union all select 'SMS' type_of_call, 'ISD' sub_ty, '1' pulse, 3 call_charge from dual ) select * from test pivot(max(CALL_CHARGE) as CALL_CHARGE, max(pulse) as pulse for (sub_ty) in ('local' as local,'STD' as std,'ISD' as isd) ) order by type_of_call desc 2 3 4 5 6 7 8 9 10 11 12 13 / TYPE_OF_ LOCAL_CALL_CHARGE LOCA STD_CALL_CHARGE STD_ ISD_CALL_CHARGE ISD_ -------- ----------------- ---- --------------- ---- --------------- ---- outgoing .3 1sec 1.5 2sec 4 1sec SMS .5 1 1 1 3 1
-
need help on creating pivot query
SELECT * FROM TEST1
----------------
VALUE OF PERSON COMPUTERNAME
COMP1 ABC 3
COMP2 ABC 5
COMP1 CAD 3
COMP3 CAD 5
COMP2 TES 1
COMP1 TES 5
COMP3 ABC 2
myQuery
----------------------------
Select the link null, label, value1 COUNT (VALUE)
from 'test1 '.
CONTROL group PER PERSON
Results
---------
Link label value1
- ABC 3
- CAD 2
- TES 2
My requirement
---------------
can we have something like that out using the concept of pivot? If so can you share an example query pls.
Link label value1
-ABC ORDI1, COMP2, COMP3
-CAD COMP1, COMP2
-YOUR ORDI1, COMP3
Hello
Subhash C-Oracle wrote:
need help on creating pivot query
SELECT * FROM TEST1
----------------
VALUE OF PERSON COMPUTERNAME
COMP1 ABC 3
COMP2 ABC 5
COMP1 CAD 3
COMP3 CAD 5
COMP2 TES 1
COMP1 TES 5
COMP3 ABC 2
myQuery
----------------------------
Select the link null, label, value1 COUNT (VALUE)
from 'test1 '.
CONTROL group PER PERSON
Results
---------
Link label value1
- ABC 3
- CAD 2
- TES 2
My requirement
---------------
can we have something like that out using the concept of pivot? If so can you share an example query pls.
Link label value1
-ABC ORDI1, COMP2, COMP3
-CAD COMP1, COMP2
-YOUR ORDI1, COMP3
This sounds like a job for LISTAGG:
SELECT NULL AS link
label
LISTAGG (comp_name, ',')
THE Group (ORDER BY ComputerName) AS value1
OF test1
GROUP BY label
;
If you would care to post CREATE TABLE and INSERT statements for your sample data, then I could test it.
Are you sure that the results you posted are what you want from data provided?
Is of the order of the elements in a significant list? In other words, when you say you want to get the results:
COMP1, COMP2
you'd be just as happy with
ORDI1, COMP2
? If the order is important, explains what this order.
-
Getting counties and divide by the sum in a single Pivot query
Hello
I have a pivot query that gives counties of all codes. I have also separated the number with the total in the same query.
Now, the output should have the counts / divided into sum multiplied by 100. Basically, the percentage.e.g col1 col2 col3 error_1 05-Jun-2012 parts error_1 05_june_2012 parts error_1 04_june_2012 consumables error_2 04_june_2012 consumables error_3 03_june_2012 parts . . .
output will be something like
Any suggestions please?error June-2012 May-2012 Feb-2012 .... headers error_1 60% 0 % 0% error_2 20% 0 0% error_3 20% 0% 0%
Thank you
Sunwith t1 as (select 'error_1' col1,trunc(sysdate) - 1 col2 from dual union all select 'error_1',trunc(sysdate) - 1 from dual union all select 'error_1',trunc(sysdate) + 30 from dual union all select 'error_2',trunc(sysdate) + 31 from dual union all select 'error_3',trunc(sysdate) - 2 from dual union all select 'error_3',trunc(sysdate) + 30 from dual union all select 'error_1',trunc(sysdate) - 3 from dual union all select 'error_2',trunc(sysdate) - 2 from dual union all select 'error_3',trunc(sysdate) + 30 from dual union all select 'error_4',trunc(sysdate) - 6 from dual ) select col1, count(case to_char(col2,'mon') when 'jul' then 1 end) one, 100 * ratio_to_report(count(case to_char(col2,'mon') when 'jul' then 1 end)) over () x, count(case to_char(col2,'mon') when 'jun' then 1 end) two, 100 * ratio_to_report(count(case to_char(col2,'mon') when 'jun' then 1 end)) over () y from t1 group by col1 order by col1
Concerning
Etbin
Edited by: Etbin on 8.6.2012 14:15
used month next to keep English and slovene "LUN" same ;) -
Progressive, Question on the fields of dynamic/DocID/Query Question of profiling
This may seem like a newb question but someone has a logical division of the BOM designation DocID?
In the course, we are responsible to use DocID = 1 and DocID = 2, but when/why would you use DocID = 3 or higher?
Any help would be greatly appreciated with the portion of dynamic fields/query string of the progressive profiling course.
Thank you.
The DocID is a complete example. You can actually assign the query string to be what you want. I recently use cmpID for the campaign ID, where I spent to map identity of the campaign and then sent the URL to redirect dynamically the campaign ID field. In my case, we worked with 10 different docs or goods, so we had to actually 10 unique codes. In this case we would have, for example cmpID = 483h76d; cmpID = 9j872hd, etc, etc. If you want to learn more about how you can use the query string values, see this post: how Progressive E10 profiling using the component of cloud - scroll down to step 6 and you'll see how to set up dynamic rules using query strings.
-
I have a request pivot within a region of APEX (pl sql function return sql query) report
declare v_term_pivot varchar2(500); PIVIN LONG; cursor xtoy is SELECT distinct d.JOB FROM emp d; v_query LONG; begin OPEN xtoy; LOOP FETCH xtoy into v_term_pivot; EXIT when xtoy%NOTFOUND; PIVIN:=PIVIN||''''||v_term_pivot||''' "'||substr(v_term_pivot,1,30)||'", '; END LOOP; v_query:='SELECT * FROM (SELECT x.ENAME, x.JOB, x.SAL FROM emp x) PIVOT ( SUM(x.SAL) FOR x.JOB IN ('||substr(PIVIN, 0, length(PIVIN)-1)||') ) order by 1;'; --dbms_output.put_line(v_query); RETURN v_query; end;
Get an error:
Failed to parse the SQL query:
ORA-01748: only here allowed simple column names
Can someone advice how can this be corrected?
I reworked the code to use the scott. EMP table.
I got the SQL Select function resulting and he ran in SQL Developer.
Syntax 1
You must remove aliases for tables of the PIVOT() section.
line 16 and 17 should be
SUM (SAL)
FOR USE IN (...)
Syntax 2
Line 11: you add comma and space (2 characters)
Line 17: you remove only 1 tank
Syntax 3 (problem semi)
Although the APEX works with it, I would abandon the semicolon (;) to the end.
To name the columns, you must create a function that returns the name of the report column.
Again, this must match the columns listed in the SELECT part
reminder of my warning:
Using a "SELECT *" and lack of "ORDER BY" in your cursor will cause you problems. (maybe not now, but it will.)
MK
-
Query does not work on my iPad (was: media query question)
I am a site for mobile/tablet/Office of coding and while my office and the iphone respond to the CSS, my ipad does not work. The changes that I do take the tablet in dreamweaver, but when they go live the ipad does not. Of course, my media query must be incorrect, but I can't understand the question. Any help is very appreciated.
http://gbetza.mydomain.com/WebService2/test/KathrynFee/2014/profile.html
Thank you.
Yes. It is inevitable because smart phones are getting bigger while tablets are smaller & more. He's always going to be some crossover. Think of it this way, when a Tablet is behaving as a mobile device, he takes over the mobile network. When the shelf behaves more like a desktop computer, you need the layout of office.
Similarly, a great smartphone in landscape mode is likely to resemble the layout of your tablet.
See the FluidGrid example below:
http://ALT-Web.com/FluidGrid/Fluid2.html
Office = 4-col layout
Tablet = 2-col layout
Mobile = 1-col layout
For purposes of illustration, I added a thick border of gold at the disposal of the Tablet only.
/ * Tablet Layout: 481px to 768px. Inherits the styles of: Mobile layout. */
@media only screen and (min-width: 481px) and (max-width: 768px) {}
.gridContainer {width: 92%; border: 16px solid gold}
}
Nancy O.
-
BI Publisher data model / query question
Hello
I'm designing a report of BI Publisher where I need to show negative numbers in red. I'm perfectly fine with the help of the conditional formatting to do this (just using the default value is conditional formatting in the add-in in MS Word, that generates code like this:)
<? If: number(Cost_-_MTD) < 0? > <? attribute@InContext:color;' Red '? > <? end if? >
BUT...
I have columns returning who sometimes have a NULL value in them, and when they have the value NULL, it causes the foregoing to the pipe upwards. So I thought, 'I'll just add IfNull() in queries defined in the model data, and who will take care of the problem... "
that works - a little. Now, my problem is if I have to go back and change the query for some reason, I get an error "query cannot be parsed, please modify the query manually. I really don't want to do that, I wish that other developers do NOT have to manually change the queries.
So my question is - is it possible to add in the IfNull() directly in the query designer, so it should not be changed manually from that moment?
p.s. using IfNull OBIEE server as our data source.
Thanks in advance,
ScottI don't think there is a way to add the ifnull condition in the query designer. So, you will need to manually change the query...
In your model so you can add additional control like this:
<0?>...Thank you!
Published by: BIPuser on Sep 17, 2010 09:20
0?> -
Replace NULL values for PIVOT query
Hello
I'm working a table for sales, for certain values, when now columns, finishing with a null value. How can I handle these values 0 (zeros).
WITH (AS PIVOT_DATA)
SELECT S.ZONE_CODE, Z.ZONE_NAME, S.YEAR, S.PERIOD, S.SALES
OF STAT_TABLE_SALES ADV
AREAS OF JOIN Z ON S.COMP = Z.COMP AND S.ZONE_CODE = Z.ZONE_CODE
WHERE S.COMP = '001'
AND S.BRAND_CODE = '001'
)
SELECT *.
OF PIVOT_DATA
PIVOT)
SUM (SALES) FOR THE PERIOD (YEAR) TO ((20091),
(2009,2),
(2009,3),
(20094)
(2009,5),
(2009,6),
(2009,7),
(2009.8),
(2009,9),
(2009.10)
(2009,11),
(2009.12),
(2010,1),
(20102)
(2010,3),
(2010,4),
(2010,5),
(2010,6),
(2010.7))
)
ORDER BY DESC NULLS LAST 14;
This query returns the following:
COD_ZONA NOM_ZONA 2009_3 2009_2 2009_1
-------- ------------------------------ ---------------------- ---------------------- --------------------
01 YEDUSIJH. 1382367.75 1559943.27 1441279.64
02 C, ASKAK 711897.82 865854,05 1583232.3
ASDFG 03 130443.03 205409,84 178633.69
04 OSOIDSD 320118.32 439008,83 409251.18
05 ODFSDF 300908.21 276301,59 260188.53
06 CH 242749.65 325196,71 464938.9
SOA 07 610312.31 606312,93 754569.82
08 SAN 89426.8 81360,04 61649.27
09 YP 284487.79 328281,31 267210.85
10 TC 87043.28 158594,43 85195.8
11 BAGNN 76778.78 68180,76 118530.04
12 CRT 122023.7 143442,21 134744.85
13 ABC 209992.79 196477,03 185222.14
IDLIB 14
15 ARE 23870.41 4137,33 16660.53
* These are not all the columns and rows, but it is a piece of what it returns.
How can I replace the NULL values with 0 (zeros).Still not sure why nvl shouldn't meet your needs:
SQL> select ename, nvl (clerk_20, 0) clerk_20, nvl (sal_30, 0) sal_30 from emp pivot (sum (sal) for (job, deptno) in ( ('CLERK', 20) clerk_20, ('SALESMAN', 30) sal_30)) / ENAME CLERK_20 SAL_30 ---------- --------------- --------------- WARD 0 1250 JONES 0 0 TURNER 0 1500 ADAMS 1100 0 ALLEN 0 1600 SMITH 800 0 CLARK 0 0 KING 0 0 BLAKE 0 0 JAMES 0 0 FORD 0 0 SCOTT 0 0 MARTIN 0 1250 MILLER 0 0 14 rows selected.
-
All (running 11.2 OEL on 5),
I'm fighting figuring how to get the result I want to with the following data:
Here's what I would get. The column date 10 - Jun 10 - Jul is 'dynamic', and there will be a new column each month.CREATE TABLE REGION_LOOKUP ( REGION_ID NUMBER NOT NULL ENABLE, REGION VARCHAR2(5) NOT NULL ENABLE, PRIMARY KEY ("REGION_ID") ENABLE ) / CREATE TABLE IND_REVENUE ( ID NUMBER, IND_REV_DATE VARCHAR2(30), IND_REVENUE NUMBER, REGION_ID NUMBER, CONSTRAINT IND_REVENUE_PK PRIMARY KEY (ID) ENABLE ) / INSERT INTO REGION_LOOKUP (REGION_ID, REGION VALUES(1,'EMEA'); INSERT INTO REGION_LOOKUP (REGION_ID, REGION VALUES(2,'LAD'); INSERT INTO REGION_LOOKUP (REGION_ID, REGION VALUES(3,'APAC'); INSERT INTO REGION_LOOKUP (REGION_ID, REGION VALUES(4,'NAS'); INSERT INTO REGION_LOOKUP (REGION_ID, REGION VALUES(5,'JAPAN'); / INSERT INTO IND_REVENUE VALUES(1,'10-Jun',73.10,4); INSERT INTO IND_REVENUE VALUES(2,'10-Jul',49.30,4); INSERT INTO IND_REVENUE VALUES(3,'10-Jun',3.20,2); INSERT INTO IND_REVENUE VALUES(4,'10-Jul',0.30,2); INSERT INTO IND_REVENUE VALUES(5,'10-Jun',28.60,3); INSERT INTO IND_REVENUE VALUES(6,'10-Jul',12.40,3); INSERT INTO IND_REVENUE VALUES(7,'10-Jun',64.00,1); INSERT INTO IND_REVENUE VALUES(8,'10-Jul',19.80,1); INSERT INTO IND_REVENUE VALUES(9,'10-Jun',6.60,5); INSERT INTO IND_REVENUE VALUES(10,'10-Jul',4.70,5); /
I think something like that (I'm stuck) but of course, this does not at all and is also hardcoded regarding columns.Region 10-Jun 10-Jul Total APAC $28.6 $12.4 $41.0 EMEA $64.0 $19.8 $83.8 JAPAN $6.6 $4.7 $11.3 LAD $3.2 $0.3 $3.5 NAS $73.1 $49.3 $122.4 Total $175.5 $86.5 $262.0
All great ideas?select rn, 10-Jun, 10-Jul, (10-Jun + 10-Jul) as Total from (select RL.REGION_NAME as rn, RL.REGION as re, IR.IND_REVENUE as rev from REGION_LOOKUP RL, IND_REVENUE IR where IR.region_id = RN.region_id) pivot (SUM(rev) for rn in ('10-Jun' as 10-Jun, '10-Jul' as 10-Jul))
See you soon,.
Andy
Fixed the instructions insert, sorry about that. Copy and paste before the coffee is not good.Hi, Andy.
A Tael says:
A nice solution,Thanks, but what solution do you mean? There were at least 4 different solutions on this page.
but is there a way to avoid the queue to a file?
Do you mean the dynamic SQL solution? Yes, the coil is just a way to make the dynamic SQL statements.
In SQL * more you can write the variable part of the query to a substitution variable (see below).
In PL/SQL, you can assemble a select in VARCHAR2 variable.PROMPT ========== 2. Dynamic Pivot using Substitution Variable ========== -- ***** Preliminary Query: ***** COLUMN sql_txt_col NEW_VALUE sql_txt WITH all_jobs AS ( SELECT DISTINCT job , DENSE_RANK () OVER (ORDER BY job) AS r_num FROM scott.emp ) SELECT SYS_CONNECT_BY_PATH ( job || ''' THEN 1 END) AS ' || job || '_CNT' || CHR (10) -- Newline, for legibility only , ', COUNT (CASE WHEN job = ''' -- Delimiter, goes before each entry ) AS sql_txt_col FROM all_jobs WHERE CONNECT_BY_ISLEAF = 1 START WITH r_num = 1 CONNECT BY r_num = PRIOR r_num + 1 ; -- ***** Main Query ***** SELECT deptno &sql_txt -- Ends with newline, so occupy that line FROM scott.emp GROUP BY deptno ORDER BY deptno ; /* EXPLANATION: Using a substitution variable is very similar to using a script. The main difference is that the output of the preliminary query has to go into one row. This is done with SYS_CONNECT_BY_PATH, and getting that requires that the jobs be numbered with consecutive integers, 1, 2, 3, ... which we get from DENSE_RANK. The NEWLINE character was added just to make the output line easier to read during debugging. */
-
I have a table that has at least 40 values that I need to use as variables in CCA. My question is. If I write the query as follows:
SELECT AS $Var1 of the value1, value2 AS $Var2, ETC... I do for 40 fields. Would it work if I just do a query where I
SELECT * FROM DBNAME WHERE CALLER = "$ANI."
and then simply use the column as variables names?If you need 40 variables in your campaign to act on and use in logic, then you must list and assign all 40 as your first example.
-
11G Pivot query with Oracle EBS
Hi all
We try to use the request function pivot 11G with Oracle E-Business Suite data. We have a database 11G installed with our Oracle APEX. We do not seem to get the pivot function to work. In short, anyone would be able to see the glaring errors in our syntax. I am not sure that it is possible to provide data of test so...
We try to have with the period column headers names SEP-08 OCT-08 NOV-08, with rows of segment2 007751 and accounted_dr as DataSet.
When we run the sql code we get an error ORA-00904: "PERIOD_NAME": invalid identifier.
Any help or idea would be greatly appreciated.
Select * from)
Select segment2, accounted_dr, period_name
gl_je_lines a, gl_code_combinations b
where b.code_combination_id = a.code_combination_id
and segment2 = "007751")
Pivot
(
Sum (accounted_dr)
for period_name ("SEP-08', ' 08 OCT ', ' NOV-08'")
)
Segment2 group, period_namelilhelp wrote:
Hi all
We try to use the request function pivot 11G with Oracle E-Business Suite data. We have a database 11G installed with our Oracle APEX. We do not seem to get the pivot function to work. In short, anyone would be able to see the glaring errors in our syntax. I am not sure that it is possible to provide test dataWhy not?
>We try to have with the period column headers names SEP-08 OCT-08 NOV-08, with rows of segment2 007751 and accounted_dr as DataSet.
When we run the sql code we get an error ORA-00904: "PERIOD_NAME": invalid identifier.Any help or idea would be greatly appreciated.
Select * from)
Select segment2, accounted_dr, period_name
gl_je_lines a, gl_code_combinations b
where b.code_combination_id = a.code_combination_id
and segment2 = "007751")
Pivot
(
Sum (accounted_dr)
for period_name ("SEP-08', ' 08 OCT ', ' NOV-08'")
)
Segment2 group, period_nameDo not use GROUP BY. When you use PIVOT, the group is involved with what is in the PIVOT clause and which is not.
Try this:select * from ( select segment2 , accounted_dr , period_name from gl_je_lines a , gl_code_combinations b where b.code_combination_id = a.code_combination_id and segment2 = '007751' ) pivot ( sum (accounted_dr) for period_name in ('SEP-08','OCT-08','NOV-08') ) ;
which is just your query validated without the GROUP BY clause.
-
I develop a connector and had some questions about the presentation of the petition. I tried to read the documentation and help, but saw no reference to these issues. I know that some of these things may not still have public API, but any help would be appreciated.
(1) is it possible to disable the entry blank for a ComboBox and set one of the values? I am referring to when you click on the button '+' on a query and selecting a comboBox field. I tried the 'enableEmptyEntry' attribute but could do not seem to work.
(2) is there a way to prevent several lines for the same domain? I'm trying to match a web interface that allows values separated by commas in certain areas and not others. Trying to decipher the intent of the user if they use multiple lines for the same field becomes confused.
(3) is there a way to disable 'Match All' or 'match any '?
Thank youAfter further review, the removal of the empty the box entry drop-down list on the query page is not possible.
One feature that we've added in the last release to support the case where the user needs to find records with a null or empty value for this combobox field. For example, finding bugs without test status. We have generic for all drop-down list boxes.
The 'enableEmptyEntry' attribute is intended to work with the attribute "emptyEntryValue" as a pair. The user can do something like this in def.xml:
enableEmptyEntry = 'true '.
"emptyEntryValue =""
Our framework posterin the drop-down list instead of empty or the default value . We recorded a feature request for this for a future version. Currently, writer connector is not a way to customize our application page, including the MatchAll, MatchAny option.
-
Ive HI you try to run a query that uses an apex link var to add a where clause per month on a date field
Select print_month, to_char (PRINT_MONTH, 'Month') of print_schedule
This query returns
"PRINT_MONTH", "M".
' 01/12/2015', 'December '.
' 01/12/2015', 'December '.
' 01/10/2015', 'October '.
' 01/10/2015', 'October '.
' 01/08/2015', 'August '.
Now then I try this query
Select print_month, to_char (trunc (PRINT_MONTH), 'Month') of print_schedule where to_char (trunc (PRINT_MONTH), 'Month') = 'December '.
I have some found data.
The print_month field is a date column.
Oracle 12 c
HI, I fixed that I noticed when I opened the csv file in a text editor so that I could paste the result in the post that there are spaces at the end of month names string, so I added in the trunk as I thought that would fix it, but it didn't so I added now in a PLATE and it works
Select print_month, RTRIM (to_char (trunc (PRINT_MONTH), 'Month')) from print_schedule where RTRIM (to_char (trunc (PRINT_MONTH), 'Month')) = "December".
So I have some might explain why this is the case, why should I cut the tank a date version?
Measure out why add white space on the end?
Maybe you are looking for
-
I have Firefox 12.0. It does not work with Mac OS 10.4.11. I don't want to have to buy a new computer right now. I would go back to a previous version of Firefox that will work with my operating system. How can I download an older version of Firefox?
-
Some file types are not not in the settings of Applications
OS: Windows XP SP3Firefox 4.0 & Pale Moon 4.0.5 I have a problem when I download files from the executable (.exe) type. Previously, I checked the sign while Firefox will automatically download the file via the Download Manager. Unfortunately, some si
-
Records on Satellite L30 - 101 possible?
I would get my Trust webcam work with Skype and have installed the correct drivers for Vista, but I get a message saying "this computer has no recording equipment" (or words to that effect). I can't find registration opportunities in accessories so I
-
Ive got a didital nine unused usb just lost the manual photo frame, ive plugged into my laptop and windows tells me there is a problem with it (code 43) what is the code 43 and what can I do to use my unit ive tried updating drivers and it still says
-
recover a file that I save something more?
I accidentally save a file to another file using the same name. Can I retrieve the original file?