Need to display different columns in a row
Hello
Im trying to get out a total sales person report for each month.
for example:-person name sales of the month
1 Jan 1000
1 Feb 2000
2 March 500
2 Dec 300
Is it possible to get the result as below
1
Jan 1000
Feb 2000
2
March 500
Dec 300
I need to show a relationship with the sales person 20 albums for a specified period with distribution of the month
for example Jan Feb March April Total
Person 1 10 30 10 10 60
Person 2 0 0 29 0 29
Help, please
Concerning
Sakho
Something like that?
SELECT person_name,
"Jan."
"Feb."
"Mar."
"April,"
«Can»,
"Jun"
"Jul"
"Aug."
"Ms."
"Oct."
"Nov."
"Dec."
total sum_sal
Of
(
SELECT person_name,
month_,
sales,
sum_sal
Of
(
SELECT person_name,
month_,
sales,
sum_sal,
ROW_NUMBER() over (ORDER BY sum_sal DESC) rn
Of
(SELECT person_name,
month_,
sales,
Sum(sales) OVER (PARTITION BY person_name) sum_sal
FROM tablename))
WHERE the rn<>
PIVOT (sum(sales) to month_ IN ('JAN' AS "Jan",
AS "Jan", "FEB"
"MAR" AS "Mar."
"APR" AS "April"
"CAN" AS "can", he said.
"JUN" AS "Jun"
"JUL" AS "Jul."
"AUG" AS "Aug"
"MS" AS "Ms."
"OCT" AS "OCT."
"NOV" AS "NOV."
'DEC' AS 'DEC'))
Tags: Database
Similar Questions
-
Help needed to display a column in a query for report
Hello
I need your help for the display of the total quantity based on a column that is already read by the query. My query is below:
SELECT 'Order MO' we.wip_entity_name, msi.segment1 'MO Assembly. "
MSI.item_type ITU, we.primary_item_id,
TRUNC (wdj.scheduled_start_date) "regular MO Start Date."
WDJ.start_quantity 'MO planned Qty. "
WDJ.quantity_completed 'MO finished Qty. "
(wdj.start_quantity - wdj.quantity_completed) "MO remaining Qty."
(CASE
WHEN (SUBSTR (wdj.attribute7, 3) = mtrl.line_id)
AND we.primary_item_id <>mtrl.inventory_item_id
)
THEN we1.wip_entity_name
Of OTHER mtrh.request_number
END
) mo_number,.
(CASE
WHEN (SUBSTR (wdj.attribute7, 3) = mtrl.line_id)
AND we.primary_item_id <>mtrl.inventory_item_id
)
THEN msi2.segment1
END
) mo_assembly,.
(CASE
WHEN we.primary_item_id <>mtrl.inventory_item_id
THEN TRUNC (wdj.scheduled_start_date)
Of OTHER TRUNC (mtrl.date_required)
END
) scheduled_start_date,.
Mtrl.Quantity required_quantity,
NVL (mtrl.quantity_delivered,
NVL (mtrl.quantity_detailed, 0)
) issued_qty,.
Mtrl.line_id, msi.inventory_item_id, mtrl.header_id,
remaining_qty einv_mo_reserve_remain_qty (mtrl.line_id),
einv_get_real_onhand_qty (mtrl.organization_id,
Mtrl.inventory_item_id,
Mtrl.from_subinventory_code,
Mtrl.from_locator_id
) onhand.
DECODE (a.remain_qty,
0, (wdj.start_quantity - wdj.quantity_completed).
a.remain_qty
) mo_assy_remain_qty
OF wip_entities.
wip_entities we1,
wdj wip_discrete_jobs,
wip_discrete_jobs wdj1,
MSI mtl_system_items_b,
wip_lines wl,
mil mtl_item_locations
mtl_txn_request_lines mtrl,
mtl_txn_request_headers mtrh,
mfg_lookups ml,
mfg_lookups ml1,
mtl_system_items_b msi2,
wip_operation_resources wor,
(SELECT NVL (SUM (wdj.required_quantity - wdj.quantity_issued),))
0
) remain_qty,.
inventory_item_id
OF wip_requirement_operations wdj
WHERE wdj.organization_id = 205
GROUP BY inventory_item_id) a
WHERE we.organization_id = wdj.organization_id
AND we.wip_entity_id = wdj.wip_entity_id
AND wdj.organization_id = msi.organization_id
AND wdj.primary_item_id = msi.inventory_item_id
AND wdj.organization_id = mtrl.organization_id
AND wdj.organization_id = mil.organization_id
AND wdj.completion_subinventory = mil.subinventory_code
AND wdj.completion_locator_id = mil.inventory_location_id
AND SUBSTR (wdj.attribute7, 3) = mtrl.line_id
AND wdj.organization_id = wl.organization_id
AND wdj.line_id = wl.line_id
AND wdj.organization_id = wor.organization_id
AND wdj.wip_entity_id = wor.wip_entity_id
AND wor.autocharge_type = ml.lookup_code
AND ml.lookup_type = 'BOM_AUTOCHARGE_TYPE. '
AND mtrh.header_id = mtrl.header_id
AND mtrl.inventory_item_id = msi2.inventory_item_id
AND msi2.organization_id = wdj.organization_id
AND ml1.lookup_type = 'MTL_TXN_REQUEST_STATUS. '
AND ml1.lookup_code = mtrl.line_status
AND wdj.start_quantity > 0
AND wdj.start_quantity > wdj.quantity_completed
AND a.inventory_item_id = msi.inventory_item_id
AND mtrl.inventory_item_id = we1.primary_item_id
AND wdj1.wip_entity_id = we1.wip_entity_id
AND SUBSTR (wdj1.attribute7, 3) = mtrl.line_id
AND IN we.wip_entity_name
("8OAS4781EBR3011",
"8OAS4781EBT3007,"
"91AS7382EBR3003,"
'91AS7382EBT3001 '.
);
Expected results:
....... Line_ID Inventory_Item_ID Remaining_Qty Total_Rem_Qty
3066336 259376 150 150
2884782 259378 228 378
3066336 259378 150 378
2884782 281571 228 228
I need the total remaining qty based on the inventory_item_id (specimen o/p 2 & 3).
Thanks in advance.You can either use functions of aggregation or analytical functions according to your requirement.
You did not mention exactly how your output should look like.
If you want the sum of the remaining_qty then
Select inventory_id, sum (remaining_qty) of (your query)
Inventory_id group.If you want to than the sum of the remaining_qty as well as your previous output
thenuse
Sum (remaining_qty) on total_rem_qty (inventory_id)
Here, you don't need to use any group of.
But it will be like a total cumulative.
If it is not your problem, give us your expected results.
-
Display different results in a hardcoded LOV
version 4.0.2.00.06
Hello
I have a list of selection multiple selection that I now need to display different results depending on the value in a hidden field, cust_type. Display and return values are hard coded values that they don't have a table.
If the cust_type = 'R' I need the results are:
0
1-50
50-100
100-500
500-1 000
more than 1000
If the cust_type = 'B', I need the results are:
0
1-1 000
1 000-5 000
5 000-10 000
10 000-25 000
25 000 +.
Could someone help me with how to do this?
Thank you
Joecheck the link againg, I changed the code.
* Mark correct if the code has helped you! *
-
How to display rows of data in different columns?
I'm new to SQL and currently, that's what I try to do:
Display multiple lines of data in different columns in the same row
I have a table like this:
CREATE TABLE TRIPLEG)
T # NUMBER (10) NOT NULL,
STEP # NUMBER (2) NOT NULL,
DEPARTURE VARCHAR (30) NOT NULL,
VARCHAR (30) DESTINATION NOT NULL,.
CONSTRAINT TRIPLEG_PKEY PRIMARY KEY (T #, LEG #).
TRIPLEG_UNIQUE UNIQUE CONSTRAINT (T #, DEPARTURE, DESTINATION).
CONSTRAINT TRIPLEG_FKEY1 FOREIGN KEY (T #) REFERENCES TRIP(T#));
INSERT INTO TRIPLEG VALUES (1, 1, 'Sydney', 'Melbourne');
INSERT INTO TRIPLEG VALUES (1, 2, 'Melbourne', 'Adélaïde');
The result should be something like this:
> T # | ORIGIN | DESTINATION1 | DESTINATION2
> 1 | SYDNEY | MELBORUNE | ADELAIDE
The request must include the ' COUNT(T#) < 3' since I only need to display the records of less than 3. How can I get the results I want to use relational views?
Thank you!!!
I replaced the syntax "where" with the syntax 'account '. The reason why I do this is because I want to only display records with a number of travel of less than 3. By defining where the legs #.<=3, the="" result="" will="" be="" all="" the="" records="" of="" the="" tripleg="" table="" since="" each="" record="" could="" also="" have="" leg#="" is="">=3,>
The answer is:
with t as (SELECT t #,)
REGEXP_REPLACE)
LISTAGG (start |) '->' || destination, ' ')
THE Group (ORDER BY t #, leg #).
'([^ ]+) \1+',
"\1") str
OF tripleg
HAVING COUNT (T #)<>
GROUP BY t #)
Select T #, regexp_substr (str, ' [^->] +', 1, 1) departure
, regexp_substr (str, ' [^->] +', 1, 2) destination_1
, regexp_substr (str, ' [^->] +' 1, 3) destination_2
, regexp_substr (str, ' [^->] +' 1, 4) destination_3
Thanks to Marty and knani!
-
Best way to display a set of data rows (15 + columns)?
Hey,.
I have a set of data rows in a data from a JAVA call control. Rowset contains about 15 + columns of data that I need to display to the user in a grid. What is the best way to achieve this? When I try to drag the control of data lines in the AMX only obvious choice page seems to be seen list but I can't just use some columns in a list view. Or an iterator. I guess I should use iterator somehow, but what is the best way to present this data?
Manually, you can go and edit the list to add more columns and place fields in them.
Check out the application workbetter to see some models list (for example, people discovered) sample.
Oracle Mobile Application Framework samples
You might want to rethink your design and have a limited set of fields appear in the list, and then when you select a list item data show the rest of the info.
a very large list is perhaps not ideal for a mobile screen.
-
In 31 FF, data tables are correctly Spa. The same page in FF32 has only a fixed number of spaces between the columns. Therefore, the shorter entries displayed differently from longer. Unfortunately, I do not know how to post screenshots here.
Thank you very much. One of your advice has solved the problem... more on that in a moment. The curious is I have made no changes whatsoever, other than to give approval to upgraded to FF v31 v32. I have FF running on two computers, Win 7 HP - so only put 64-level, who then had the problem. The second machine, always with v31 FF worked 'normally '. Although it may be useless I've added screenshots of two machines to show what I was seeing.
Having said that, I discovered, thanks to your tip, that the box: 'Allow pages to choose their own fonts' has been disabled in the upgraded version. How this has happened is beyond me, since as I said, I have Nothing , but give permission to upgrade.
Thanks again.
-
the analysis of a word table of ms with different numbers of columns for each row
I'm reading in a MS Word table that contains 20 lines, each with a different number of columns. I have to iterate over each line then I iterate on each column of the row and read his text. I don't know a way to find out how to stop an iteration on the columns. Is a property or a method which tells you the number of columns in a specific line for a table in MS Word?
ID says:
I'm reading in a MS Word table that contains 20 lines, each with a different number of columns. I have to iterate over each line then I iterate on each column of the row and read his text. I don't know a way to find out how to stop an iteration on the columns. Is a property or a method which tells you the number of columns in a specific line for a table in MS Word?
For each row, use the count property of cells. Since there a number of subject lines is the number of columns.
Ben64
-
give user option to display a column in asc/desc as needed
Hi all
I have a report and I want to give the user the flexibility that it can display a column in a way asc/desc fields.
Is it possible for a user to give an option as a button or some list drop down so that he can make a choice to view the results accordingly.
If anyone can suggest a way... !
Thank youJin
In a table view, we have the option "Enable column sorting in the dashboards.View table--> Table View Properties--> check the column enable sorting in dashboards.
While in dashboard users have the flexibility to sort their reports asc/desc...Thank you
saichand.v -
Compare and display several column data according to requirement
Hello
I have a requirement where I want to compare the data in two tables and display only the columns if there is a gap using the sql query.
Tell userid, e-mail and phone number of the same employee is stored in two tables. Now, I want to compare data from e-mail and phone number of the two tables and display the e-mail and phone number as if they are different data.
Employee table:
user_id E-mail phone emp01 [email protected] 00200 emp02 [email protected] 00300
emp03 [email protected] 00400 Table user_details:
ID user_email user_phone emp01 [email protected] 00201 emp02 (null) 00300 emp03 [email protected] 00401 Please note that both tables have completely different column names and the data may contain a null as well. What I want to achieve is to compare the same employee data in both tables and display columns that have a different value of user_details table; as:
user_id user_email phone emp01 [email protected] 00201 emp02 (null) emp03 [email protected] 00401 As the table column names are different, I can't use a join and less to know the difference. I tried this with the help of CASES after the WHERE clause for comparison of columns multiple but GOLD or AND the two would defy the condition to display all columns with different data for the same line.
How to do this without creating a separate view or a table that I don't have write access? Pointers would be useful.
-Thank you.
No need for something like
You just run
Select k.user_id, k.id,.
e.email, u.user_email,
e.Phone, u.user_phone
of user_key_table k
left outer join
e employee
On k.user_id = e.user_id
left outer join
user_details u
on k.user_id = u.id
the rest is here just to simulate your tables (I don't want to create tables in my APEX Tablespace as there are far too many people already)
Concerning
Etbin
-
Need to extract query text in each row tags
I need to display a list of tags used in particular the text for each line. After sample data can give clear you the idea.
DB version:
========
Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production
Sample data:
==========
WITH txt_data AS)
SELECT the 1 id, txt "your price #toy_name # is #price_amt #.» FROM DUAL
UNION ALL
SELECT id 2, "it's product tag #pdt_tag #." It is a client #clt_tag tag # and finally this notice tag #adv_tag #. ' txt FROM DUAL
UNION ALL
SELECT 3 id, "Hi Mr. #clt_name #." txt FROM DUAL
)
SELECT * FROM txt_data;
Power required:
============
ID TAGS 1 #toy_name #, #price_amt #. 2 #pdt_tag #, #clt_tag #, #adv_tag #. 3 #clt_name #. To implement this I used the technique of factoring of the recursive subquery for a static data (row). Seen the query below.
WITH tag_list (ip_str, case, tag) as)
SELECT ' this is product #pdt_tag tag #. It is a client #clt_tag tag # and finally this notice tag #adv_tag #. ' AS ip_str, 0 accident AS, null AS tag FROM DUAL
UNION ALL
SELECT ip_str, here + 1, REGEXP_SUBSTR (ip_str, ' (#. *?)) (#)', 1, case + 1) OF tag_list WHERE REGEXP_SUBSTR (ip_str, ' (#. *?)) (#)', 1, case + 1) IS NOT NULL
), SELECT WMSYS. WM_CONCAT (tag) OF tag_list WHERE case > 0;
But when I use this technique for the data in the table, it gives me the error. Given below.
WITH txt_data AS)
SELECT the 1 id, txt "your price #toy_name # is #price_amt #.» FROM DUAL
UNION ALL
SELECT id 2, "it's product tag #pdt_tag #." It is a client #clt_tag tag # and finally this notice tag #adv_tag #. ' txt FROM DUAL
UNION ALL
SELECT 3 id, "Hi Mr. #clt_name #." txt FROM DUAL
)
SELECT t.id,
(WITH tag_list (ip_str, case, tag) as ())
SELECT t.TXT AS ip_str, 0 accident AS, null AS tag FROM DUAL
UNION ALL
SELECT ip_str, here + 1, REGEXP_SUBSTR (ip_str, ' (#. *?)) (#)', 1, case + 1) OF tag_list WHERE REGEXP_SUBSTR (ip_str, ' (#. *?)) (#)', 1, case + 1) IS NOT NULL
), SELECT WMSYS. WM_CONCAT (tag) OF tag_list WHERE case > 0) as tags
OF txt_data t.
ORA-00904: "T". "" TXT ": invalid identifier
00904, 00000 - '% s: invalid identifier '.
* Cause:
* Action:
Error on line: column 50: 17
Issues related to the:
----------------
1. help reach my goal (with your own logic, whatever my technique)
2. What is the problem with my technique above? Cannot use us WITH the clause in the selection list?
Thanks in advance
Personally I would rewrite the expression of regexp as ' #[^ #] * #'
In addition, we can get rid of the place where the main expression
with tag_list (ip_str, case, tag) as)
SELECT TXT AS ip_str, 1 match AS
REGEXP_SUBSTR(txt, '#[^#]*#', 1, 1) AS tag
of txt_data
UNION ALL
SELECT ip_str, here + 1
, REGEXP_SUBSTR (ip_str, ' #[^ #] * #', 1, case + 1)
OF tag_list
WHERE REGEXP_SUBSTR(ip_str, '#[^#]*#', 1, occurrence + 1) IS NOT NULL
)
SELECT
ip_str
, listagg (tag, ',') within the Group (by instance) s
OF tag_list
Ip_str group
Finally, you can save a regexp_substr
with tag_list (ip_str, case, tag) as)
SELECT TXT AS ip_str, 1 match AS
REGEXP_SUBSTR(txt, '#[^#]*#', 1, 1) AS tag
of txt_data
UNION ALL
SELECT ip_str, here + 1
, REGEXP_SUBSTR (ip_str, ' #[^ #] * #', 1, case + 1)
OF tag_list
)
cycle tag cyl set default 1 0
SELECT
ip_str
, listagg (tag, ',') within the Group (by instance) s
OF tag_list
Ip_str group
-
Hi, I have a table has a 2 column layout.
id_dep id_val
--------- --------
1A
1 B
1 C
2 G
3 L
2.
3 P
3 X
I need a view or a table that displays data like this.
id_dep id_val1 id_val2 id_val3 id_val4
--------- ---------- ---------- ---------- ----------
1 C
2 G
3 L O P X
I have seen a few examples with values in the same column, but I really need separate field for each value.
Any help would be much appreciated,
Thank you! We use Oracle 10.Hello
Welcome to the forum!
As Centinul said, it's called swivel and the Centinul post link has several good pages.
Something crucial about swing is that before you do rotate, you know, look at each line of no cross-data Dynamics, rows and columns will be affected by this line. For example, looking at the line with id_dep = 2 and id_val = 'G', how can tell you where (what row and column) who will go 'G '? id_dep uniquely identifies the line, but there is nothing in the table that indicates if the 'G' will end up in the 1st column crosstab, or 2nd or 3rd, or... Before you can rotate the data, you must generate a number for yourself.
Since I don't have a copy of your table, I'll use the table scott.emp to illustrate. Say we want to list the employees in each Department, in alphabetical order, like this:
` DEPTNO NAME1 NAME2 NAME3 NAME4 ---------- ---------- ---------- ---------- ---------- 10 CLARK KING MILLER 20 ADAMS FORD JONES SCOTT 30 ALLEN BLAKE JAMES MARTIN
Deptno column (like you id_dep) is all we need to know about what an exit row corresponds to each input line, but we must build something which says "CLARK" will go in the same column as "ADAMS" and "ALLEN". This soemthing is in this case, the ROW_NUMBER analytic function:
WITH got_r_num AS ( SELECT deptno, ename , ROW_NUMBER () OVER ( PARTITION BY deptno ORDER BY ename ) AS r_num FROM scott.emp -- WHERE ... -- If you need any filtering, this is where it goes ) SELECT deptno , MIN (CASE WHEN r_num = 1 THEN ename END) AS name1 , MIN (CASE WHEN r_num = 2 THEN ename END) AS name2 , MIN (CASE WHEN r_num = 3 THEN ename END) AS name3 , MIN (CASE WHEN r_num = 4 THEN ename END) AS name4 FROM got_r_num GROUP BY deptno ;
Thanks for posting your version number; It's always good to do whenever you have a question. Sometimes the difference between Oracle 10.1 and 10.2 can be important. It is best if you post your full version, for example 10.2.0.4.0.
The query above works in Oracle 9 and 10. Of course, it will not work in higher versions, too, but if you have Oracle 11 then you would like to use the SELECT new... PIVOT functionality, instead. -
Shakes the screen & display different colors opening lid
HY, need help...
I've had this laptop for 2 years and never had any problems, but a few days when I move the screen to open, adjust or close the screen shakes and display different colors.
Is there something I can do or is the time to take for repair?Thank you
Hello
In my opinion it s definitely a hardware problem.
Either there is something wrong with the connection or the screen itself.It seems that you have no experience in the laptop repair and so there is no sense in doing this.
First of all, I doubt that you have all the tools to check what part is affected and then you could damage other parts while removing the procedure.So I think that you should get in touch with local laptop technician and should first try to know what's exactly wrong
Then you can decide what you would then doI mean the screen is one of the expensive components for laptop and possibly it s not worth buying a new
-
OBIEE 11 g Date between guest in different columns
Hello
I did, between guest day in Obiee by using this statement: link. It works well, but I need to manipulate different in a different column, for example:
Data source values:
100 2009
100 2010
100 2011
100 2012
100 2013
Guest (what I choose in the analysis)
StartDate: 2011
EndDate: 2012
Results of the analysis (sum):
Column A column B
200 400
Explanation of the results: column A contains the sum of 2011 and 2012, it is ok and works well. My problem is the B column; I want to use prompt EndDate, but ignore the prompt StartDate, the result should be 400 (2009:100 + 2010:100 + 2011:100 + 2012:100).
Do I need to use this prompt EndDate in colum of B?
I found the solution! Here it is if anyone else have the same problems:
1. create guests: startdate and enddate
2. then call created invites in the formula editor:
FILTER ("some". "WITH something' ('time'". "the dimension' between 2000 and @{enddate})))"
FILTER ("some". "WITH something' ('time'". "between dimension' @{startdate} and @{enddate})))"
-
Find the same value in different columns
Hello
I'm trying to figure out how I would get the same value in the same row but in different columns. For example, in the table sometimes report the name is the same as the description. I would like to find all the lines where this is the case.
Thank you
Name of the report Description Date Time Report 1 Report 1 Delalande TTTT Report 2 Billing report Delalande TTTT Report 3 Report 3 Delalande TTTT Hello
Is that what you want?
SELECT *- or whatever the columns that you want to
FROM table_x
WHERE description = report_name
;
If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).See the FAQ forum: https://forums.oracle.com/message/9362002
-
Need to display additional information to the hideshow in advanced table
Dear all,
I have a requiremnt as below.
I have an advanced table and displaying data between a VO below and which, I need to display additional information after clicking on one of the field on the line.
Basically, I need hideshow kind of features when you click a field in the row.
Please help me on this
Hello
Fallow under steps it will work for you.
Step 1: Select advanced table right click and create detail area for table advanced. (detail)
Step 2: Create Message component provision under the detail Section. (DetailRN)
Step 3: Add (point information) under DetailRN and correct view Instance and view attribute.
Here's how structure component look.
TableRN (advanced table)
col1
col2
Components AdvancedTable
in detail
DetailRN
COL3 (additional information)
COL4 (additional information)
Let me know any questions.
Thank you
Dilip
Maybe you are looking for
-
I bought a smartphone and export my addresses, which must be made in vcf format. How can I do?
-
How go I add cd track information after the entry in cd in itunes
How go I add cd track information after the entry in cd in itunes
-
Hi all desperately need help! My wife turned off the laptop as usual last night, tried to launch today, had the power light, green battery (attached power) got what I suppose is the sound processor fan but no disk hard sounds at the wheel, the screen
-
Satellite A210-1AH - USB conflict pci bus controllers resource at startup
Hello I have a Toshiba Satellite A210-1AHmodel without PSAFGE-05X01GDU When I start the laptop after the toshiba logo. The laptop gives the following error: Bus ERROR USB controller resources conflict pci on the motherboardBus: 14, device: 06, functi
-
OfficeJet 6600: iPad suddenly can not find wireless HP printer.
iPad, suddenly cannot find a working HP officejet wireless printer! He worked recently.