Help on the game of query results
Hi gurus,
Have this survey for my requirement of dataset sql.
Sample, it's that I have to pick up the nonfunctional currency transactions.
Lets say for a given month, data that are present are for CurrencyA and CurrencyB for a particular account.
Account1 has a transaction does not work CurrencyA and CurrenyB then Account2 has only transaction to CurrencyB.
My current query result is that the 3 first lines, what I need is the 4th should also appear and be included.
CurrencyA - amount - account1
CurrencyB - amount - account1
CurrencyB - amount - Account2
CurrencyA - < '0' / or null >-Account2
I think that my request is based on the currency < x > I have, so it should be for each account, he has all the lines for each currency.
If please notify and let me know your thoughts.
Kind regards
Hello
It looks like you want an outer join partitioned.
I hope that answers your question.
If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired 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
Tags: Database
Similar Questions
-
Help returns the array of query results
Hi all... Pretty new to this so please forgive my ignorance. Running Oracle 11 g, trying to return results as in the example I give below. I don't know how the Sport field will have unique values, and I don't know how many unique values the year field is seen in the data. Does anyone have recommendations/suggestions?
The structure of the table is:
Year of sport
Baseball 10-11
Football 10-11
Football 11-12
Football 11-12
Football 11-12
Baseball 11-12
The result should be sports in each year and should be grouped by year but shown as columns so:
(GROUP OF the year)
1, baseball 1, Football
2, 1, Football Soccer 1, Baseball
I hope that makes sense. Thanks for any help!
... KaelonDoes anyone have recommendations/suggestions?
Maybe something like:
SQL> with t as ( select 'Baseball' sport, '10-11' year from dual union all select 'Football', '10-11' from dual union all select 'Football', '11-12' from dual union all select 'Football', '11-12' from dual union all select 'Soccer', '11-12' from dual union all select 'Baseball', '11-12' from dual ) -- -- select year, listagg(cnt || ', ' || sport, ' ') within group (order by cnt desc) sports from ( select count(*) cnt, sport, year from t group by sport, year) group by year / YEAR SPORTS ------- ---------------------------------------- 10-11 1, Baseball 1, Football 11-12 2, Football 1, Baseball 1, Soccer 2 rows selected.
?
-
I am unable to find the 'run' which, according to the website of the game should be pinned to my button 'start '. Any ideas?
I am unable to find the 'run' which, according to the website of the game should be pinned to my button 'start '. Any ideas?
It is an older version of windows. In 7 or Vista, click Start, and then use the search box - enter the article they say "run" and press ENTER.
-
limit the number of query results for content Presenter CMIS
Hi dear,
I have a problem. I added content present on my page in Jdev ide, not at run time. And I need a query including the limitation of the number of results.
My query is: ${' SELECT * from ora: t:IDC:GlobalProfile WHERE the ora: p:xRegionDefinition =-"CSGMNEWS_REGDEF\" ORDER BY ora: p:dInDate DESC'}
I just want to add a number parameter.
Can you help me please? How can I limit the number of results?
Kind regards
Yacouba
Published by: erdo on 21.Mar.2013 18:37Hello.
Content Presenter has a setting (maxResults) to set the maximum returned results:
Sample:
xmlns = "http://xmlns.oracle.com/adf/controller/binding" Refresh 'ifNeeded' = >
When you add your CP to a page at design time, you can access the pageDefinition and provide more values for attributes of CP.
I hope this help you.
Kind regards.
-
the case-insensitive query results
I got a help from 11g with the suite of version information
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
PL/SQL Release 11.1.0.7.0 - Production
CORE Production 11.1.0.7.0
AMT for 32-bit Windows: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production
The result of the query are case-sensitive
Ex: Select * from Table_1 where column like '% new % ';
result: News
But do not go back NEWS News or newsThe result of the query are case-sensitive
But you want the results to be case-insensitive?
Well, then you can use:Select * from Table_1 where lower(column) like '%news%';
And use a function based index.
-
How to speed up the time to query result
When executing the following query, the result comes after 22 seconds.
How I minimize this time? Please suggest.
SanjaySELECT DISTINCT PERIOD_NO, ITEM_CODE, ITEM_NAME, SUM(CASE WHEN LEVEL_TYPE IN 'SUB ZONE' THEN WD_FORECAST_QTY_BU / CNV / ML ELSE 0 END)TOT_FRCST FROM SHEET_HEAD, SHEET_DETAIL, ITEM_DETAIL WHERE WH_SYS_ID = WD_WH_SYS_ID AND ITEM_CODE = WD_ITEM_CODE(+) AND PERIOD_NO BETWEEN :PERIOD1 AND :PERIOD2 AND WH_REVISION_NO = 0 AND WH_LEVEL_CODE NOT IN (SELECT WH_LEVEL_CODE FROM SHEET_HEAD WHERE WH_REVISION_NO = 1) GROUP BY ITEM_CODE, ITEM_NAME, WH_PERIOD_NO
Hello
with speed suggest it would be always be expirement with indexing on parameters, after that first scans all what is currently happening in what concerns analyses of full table etc. which are "more expensive."
Level of the specific actions on your code, that what follows comes out too expensive; -
AND WH_LEVEL_CODE NOT IN (SELECT WH_LEVEL_CODE FROM SHEET_HEAD WHERE WH_REVISION_NO = 1)
Here, I would see if you can rewrite, perhaps with a left join / auto join to achieve the same ends, compare the timings, you might be surprised.
Kind regards
Robert.
-
Help of the complex select query (Group by)
Hello
I am in need of your help to create a unique select query for the data in the table below and whose output requies. I use oracle 10g on RHEL 5 version.
create table bustour (number of bussno (4), start_date date, number (2)) passenger;
ALTER session set nls_date_format = "dd-mm-yyyy";
insert into bustour values (4123, April 10, 2009 ", 20);
insert into bustour values (4123, may 10, 2009 ", 25);
insert into bustour values (4123, may 10, 2009 ', 18);
insert into bustour values (4123, June 10, 2009 ', 15);
insert into bustour values (6138, March 10, 2009 ', 16);
insert into bustour values (' 6138, March 10, 2009 ", 19);
insert into bustour values (6138, April 10, 2009 ', 22);
insert into bustour values (' 6138, April 10, 2009 ", 13);
insert into bustour values ("4123, July 10, 2009 ', 23);
insert into bustour values (4123, August 10, 2009 ", 27);
insert into bustour values (4123, November 10, 2009 ', 15);
insert into bustour values (6138, may 10, 2009 ', 16);
insert into bustour values (6138, may 10, 2009 ', 13);
insert into bustour values (6138, may 10, 2009 ', 18);
insert into bustour values (' 6138, may 10, 2009 ", 24);
insert into bustour values (6138, July 10, 2009 ", 20);
insert into bustour values (6138, August 10, 2009 ", 18);
So that we can know on what particular travel calendar, we have obtained maximum passengers and the date. (For calculating % of bonus driver)SQL> select * from bustour; BUSSNO START_DATE PASSENGERS ---------- ---------- ---------- 4123 04-10-2009 20 4123 05-10-2009 25 4123 05-10-2009 18 4123 06-10-2009 15 6138 03-10-2009 16 6138 03-10-2009 19 6138 04-10-2009 22 6138 04-10-2009 13 4123 07-10-2009 23 4123 08-10-2009 27 4123 11-10-2009 15 BUSSNO START_DATE PASSENGERS ---------- ---------- ---------- 6138 05-10-2009 16 6138 05-10-2009 13 6138 05-10-2009 18 6138 05-10-2009 24 6138 07-10-2009 20 6138 08-10-2009 18 17 rows selected. I want query output as below : Bussno start_date end_Date totalpassengers maxpessenger maxpassdate 4123 04-10-09 06-10-09 78 25 05-10-09 6138 03-10-09 04-10-09 70 22 04-10-09 4123 07-10-09 11-10-09 65 27 08-10-09 6138 05-10-09 08-10-09 109 24 05-10-09
Please help me to write the query.
Best regards
NishaOK, something like this:
with my_tab as (select 1 id, 4123 busno, to_date('04/10/2009', 'dd/mm/yyyy') start_date, 20 passengers from dual union all select 2 id, 4123 busno, to_date('05/10/2009', 'dd/mm/yyyy') start_date, 25 passengers from dual union all select 3 id, 4123 busno, to_date('05/10/2009', 'dd/mm/yyyy') start_date, 18 passengers from dual union all select 4 id, 4123 busno, to_date('06/10/2009', 'dd/mm/yyyy') start_date, 15 passengers from dual union all select 5 id, 6138 busno, to_date('03/10/2009', 'dd/mm/yyyy') start_date, 16 passengers from dual union all select 6 id, 6138 busno, to_date('03/10/2009', 'dd/mm/yyyy') start_date, 19 passengers from dual union all select 7 id, 6138 busno, to_date('04/10/2009', 'dd/mm/yyyy') start_date, 22 passengers from dual union all select 8 id, 6138 busno, to_date('04/10/2009', 'dd/mm/yyyy') start_date, 13 passengers from dual union all select 9 id, 4123 busno, to_date('07/10/2009', 'dd/mm/yyyy') start_date, 23 passengers from dual union all select 10 id, 4123 busno, to_date('08/10/2009', 'dd/mm/yyyy') start_date, 27 passengers from dual union all select 11 id, 4123 busno, to_date('11/10/2009', 'dd/mm/yyyy') start_date, 15 passengers from dual union all select 12 id, 6138 busno, to_date('05/10/2009', 'dd/mm/yyyy') start_date, 16 passengers from dual union all select 13 id, 6138 busno, to_date('05/10/2009', 'dd/mm/yyyy') start_date, 13 passengers from dual union all select 14 id, 6138 busno, to_date('05/10/2009', 'dd/mm/yyyy') start_date, 18 passengers from dual union all select 15 id, 6138 busno, to_date('05/10/2009', 'dd/mm/yyyy') start_date, 24 passengers from dual union all select 16 id, 6138 busno, to_date('07/10/2009', 'dd/mm/yyyy') start_date, 20 passengers from dual union all select 17 id, 6138 busno, to_date('08/10/2009', 'dd/mm/yyyy') start_date, 18 passengers from dual) -- end of mimicking your data; use SQL below: select busno, min(start_date) start_date, max(start_date) end_date, sum(passengers) total_passengers, max(passengers) max_passengers, max_pass_date from (select id, start_date, busno, passengers, distance, max(start_date) keep (dense_rank first order by passengers desc) over (partition by distance, busno) max_pass_date from (select id, start_date, busno, passengers, -- using tabibitosan method, borrowed from Aketi Jyuuzou dense_rank() over (order by id) - row_number() over (partition by busno order by id) distance from my_tab)) group by busno, distance, max_pass_date order by min(id) BUSNO START_DATE END_DATE TOTAL_PASSENGERS MAX_PASSENGERS MAX_PASS_DATE ---------- ---------- ---------- ---------------- -------------- ------------- 4123 04/10/2009 06/10/2009 78 25 05/10/2009 6138 03/10/2009 04/10/2009 70 22 04/10/2009 4123 07/10/2009 11/10/2009 65 27 08/10/2009 6138 05/10/2009 08/10/2009 109 24 05/10/2009
-
Help - run the extended CO query?
Read the many threads on the topic prior to this announcement, but im still stuck.
I extended a sowing controller, to display text msgStyle seeded as a link under certain conditions.
I want to take is:
If (condition true) {//set the text msg destination uri} otherwise do nothing
To implement the condition, I have to make a request to check if this value exists in the table. I have not any Vo attached to achieve this.
I could create a custom VO and attach it to AM programaticaly? One last thing - AM attached to this seeded page is am root.
I read that AM root should not be extended.
How can I achieve this?Hello
For this, you can use dynamic VO, create VO, and run the query.
Kind regards
Out Sharma -
"New hardware found", and "your new hardware is ready to use" I don't know how
The minimum requirements are met. If by chance, anything to cause a problem, Setup wouldn't let you continue when you went first to install the software.
Try to install the latest version of the driver package and software Windows XP 32/64 - bit from Microsoft here:Let us know after the installation of what is happening,Thank you!Ryan Thieman
Microsoft Answers Support Engineer
Visit our Microsoft answers feedback Forum and let us know what you think. -
Number to reach the desired with query result...
Here some pseudocode tables and data to show my problem:
Desired output of tableCREATE TABLE temp (name_home varchar2(25), name_away varchar2(25), id integer); INSERT INTO temp VALUES ('a','b',1,1); INSERT INTO temp VALUES ('c','a',1,3); INSERT INTO temp VALUES ('e','a',1,4); INSERT INTO temp VALUES ('c','a',1,6); INSERT INTO temp VALUES ('d','e',1,5); INSERT INTO temp VALUES ('b','a',1,7);
NOTENAME_HOME NAME_AWAY ID SEQ a b 1 1 b a 1 7 c a 1 3 c a 1 6 e a 1 4 d e 1 5
My table contains millions or lines like this, idea would be a solution that would be enough for a table containing millions of combos like those above.
I want to display the data with the following by order:
(1) records where any combination of a value of data in "name_home" and "name_away" appears more than one time first (record e.i. with seq 1.7)
(2) sequence number CSA
So, for seq 1 and 7, it does not matter to me that 'a' and 'b' switch between name_home and name_away, they must appear first because a combo of a and b in the same record appears more than once and the number of seq of one of the files is smaller than any of the seq in the accounts rendered by 'c' and 'a '. I hope that makes sense.
Published by: user652714 on November 17, 2010 16:04Fixed, when I read until the end :)
select t.*, count(*) over(partition by greatest(name_home,name_away),least(name_away,name_home)) cnt, first_value(seq) over(partition by greatest(name_home,name_away),least(name_away,name_home) order by seq) min_seq from temp t order by cnt desc,min_seq asc
NAME_HOME NAME_AWAY ID SEQ CNT MIN_SEQ a b 1 1 2 1 b a 1 7 2 1 c a 1 3 2 3 c a 1 6 2 3 e a 1 4 1 4 d e 1 5 1 5
Kind regards
Sayan M.Published by: xtender on 18.11.2010 11:49
-
run immediately and the set of query results
Hi gurus,
I want to create a series of paintings on the fly using run immediately.
the table_names are stored in another table work_table.
run immediately (select 'create table' | table_name |) '(id int)' of
* (select table_name in work_tables)); *
This will raise error.
ORA-06550: line 1, column 18:
PLS-00103: encountered the symbol "SELECT" at the expected in the following way:
(en) - + new case mod not null < an ID >
< between double quote delimited identifiers of > < a variable binding >
instead of using a cursor to run one by one is the lines an alternative solution?
Thank you very much
CharlesMay not know why you want to do it in a single statement, anyway:
SQL> select * from work_tables; TABLE_NAME ------------------------------ x1 x2 SQL> declare 2 str varchar2(32000); 3 begin 4 for r in (select table_name from work_tables) loop 5 str := str || 'execute immediate ''create table ' || r.table_name || '( id int )''; ' ; 6 end loop; 7 8 execute immediate 'begin '||str||' end;'; 9 10 end; 11 / PL/SQL procedure successfully completed. SQL> desc x1 Name Null? Type ----------------------------------------------------------- -------- ------------------------------ ID NUMBER(38) SQL> desc x2 Name Null? Type ----------------------------------------------------------- -------- ------------------------------ ID NUMBER(38)
Max
http://oracleitalia.WordPress.comPublished by: Massimo Ruocchio, February 18, 2010 15:03
-
Select the format of query results
SELECT * FROM srm_application_data WHERE application_id = '242564';
Returns
app_id question_name data
------ ------------- -----
242564 FirstName qreq
242564 StaffID 12314
242564 of State VIC
242564 o ' Connel of suburbs
I want that data to be presented as
First name 242564 qreg staffId 12314 State VIC Subrub o ' Connelthe path q & d:
select id , wm_concat (name||' '||data) from test group by id ;
as in
SQL> with test as 2 ( 3 select 242564 id, 'FirstName' name, 'qreq' data from dual union all 4 select 242564 id, 'StaffID', '12314' from dual union all 5 select 242564 id, 'State', 'VIC' from dual union all 6 select 242564 id, 'Suburb', 'o''connel' from dual 7 ) 8 select id 9 , wm_concat (name||' '||data) 10 from test 11 group by id 12 ; ID ---------- WM_CONCAT(NAME||''||DATA) ------------------------------------------------------------------------ 242564 FirstName qreq,StaffID 12314,State VIC,Suburb o'connel
-
Query results pane should display the entire XML following the execution of the query
Hi, I'm trying to get the xml output results returned in sqldeveloper returned in full.
they are truncated to.
I tried the trick / * xml * / but that is implemented in the form xml cdata codes and other structures of nickname.
Select xmlserialize (DOCUMENT
XMLELEMENT ("root",
XMLAttributes ('http://www.millicom.com' as 'xmlns'),
XMLAGG)
XMLELEMENT ("line",
XMLFOREST (U.username,
U.user_id,
U.PASSWORD,
U.ACCOUNT_STATUS,
U.LOCK_DATE,
U.EXPIRY_DATE,
U.DEFAULT_TABLESPACE,
U.TEMPORARY_TABLESPACE,
U.CREATED,
U.PROFILE,
U.INITIAL_RSRC_CONSUMER_GROUP,
U.EXTERNAL_NAME,
U.PASSWORD_VERSIONS,
U.EDITIONS_ENABLED,
U.AUTHENTICATION_TYPE)))
AS CLOB DASH)
from dba_users U
CROSS JOIN (select 1 of the double connect by level < = 10);
Thanks for any help you can offer.
JM
Hi jm,
In the line of query results, did scroll all the way to the right, then click twice on the «...» "at the end of the line to open the cell editor?
So again, who does not show all the XML, it may be a problem with the version of the ojdb6.jar in use (11.2.0.3 client or later is required), or whether or not the JDBC OCI/thickness is used. Read the following discussion: retrieve XMLTYPE based on very slow saved schema
Kind regards
Gary
SQL development team
-
When I try to open the games on my Windows 7 system, I get the executable file to the games error message has stopped working. I tried several times to load the games following the indications for help but the games is not accessible. My computer is a remanufactured unit that was on the lease are there steps I can take to solve problems? Thank you
Original title: frustrated in New York
The problem seems to be the igdumd64.dll:
Fault Module name: igdumd64.dll
Fault Module Version: 8.15.10.1749
Timestamp of Module error: 4a5bdf54The igdumd64.dll is a component of the Intel graphics driver and seems to be an older version then try to update the graphic driver Intel.
You could try the manufacturer of the computer for an updated driver, or use the following utility for intel to check a generic version:
-
Ask help - please help me get the expected defined in a query result
Dear all,
Help with your suggestions and advice. Please see the bottom of the screenshots for the planned result sets.
create table shift_dt (name varchar2(20), shift_start date, shift_end date); insert into shift_dt values ('Brian',to_date('01-01-2015 09:10:00','dd-mm-yyyy hh24:mi:ss'), to_date('01-01-2015 22:10:00','dd-mm-yyyy hh24:mi:ss')); insert into shift_dt values ('Brian',to_date('02-01-2015 09:10:00','dd-mm-yyyy hh24:mi:ss'), to_date('04-01-2015 00:00:00','dd-mm-yyyy hh24:mi:ss')); insert into shift_dt values ('Brian',to_date('04-01-2015 00:00:00','dd-mm-yyyy hh24:mi:ss'), to_date('05-01-2015 15:20:00','dd-mm-yyyy hh24:mi:ss')); insert into shift_dt values ('Brian',to_date('06-01-2015 10:00:00','dd-mm-yyyy hh24:mi:ss'), to_date('06-01-2015 23:20:00','dd-mm-yyyy hh24:mi:ss')); insert into shift_dt values ('Brian',to_date('07-01-2015 11:00:00','dd-mm-yyyy hh24:mi:ss'), to_date('09-01-2015 00:00:00','dd-mm-yyyy hh24:mi:ss')); insert into shift_dt values ('Brian',to_date('09-01-2015 00:00:00','dd-mm-yyyy hh24:mi:ss'), to_date('10-01-2015 22:00:00','dd-mm-yyyy hh24:mi:ss')); select * from shift_dt;
Select * from shift_dt;
Expected result set: -.
I compare date of shift_end with the next date of shift_start of the day. If the dates made 12 am (IE 00:00:00), then I ignore and display the next shift end date available as displayed in the screen game result. Please see the screen set outcome turned for more details.
Please help get the results you want in the SQL query
Kind regards
Souls
Hello
Here's one way:
WITH got_new_grp AS
(
SELECT name, shift_start, shift_end
CASE
WHEN shift_start = TRUNC (shift_start)
AND shift_start = LAG (shift_end) OVER (ORDER BY shift_start)
THEN 0
1. OTHER
END AS new_grp
OF shift_dt
)
got_grp AS
(
SELECT name, shift_start, shift_end
SUM (new_grp) OVER (ORDER BY shift_start) AS grp
OF got_new_grp
)
SELECT MIN (name) DUNGEON (DENSE_RANK FIRST ORDER BY shift_start)
As a name
MIN (shift_start) AS shift_start
MAX (shift_end) AS shift_end
OF got_grp
GROUP BY grp
ORDER BY shift_start
;
Output (from the full sample data):
NAME SHIFT_START SHIFT_END
-------------------- ---------------- ----------------
01/01/2015 Brian 09:10 01/01/2015 22:10
Brian 02/01/2015 09:10 01/05/2015 15:20
Brian 06/01/2015 10:00 01/06/2015 23:20
Brian 07/01/2015 11:00 10/01/2015 22:00
Brian 01/02/2015 15:00 02/02/2015 00:00
Brian 02/02/2015 11:00 02/02/2015 17:00
Brian 03/02/2015 00:00 03/02/2015 08:00
Brian 02/05/2015 15:30 06/02/2015 07:30
Brian 07/02/2015 23:30 10/02/2015 00:30
I guess that shift_start is unique.
It's finally a GROUP BY problem: we want to show the first shift_start and the last shfit_end of a group of 1 or more lines. The tricky part is to identify the groups. If I understand the problem, line X is grouped with the previous line X-1 if shift_start on the X line is midnight and is equal to shift_end on line X-1. The above query uses the LAG analytic to see if each line begins a new group or not and the analytic function SUM to see how many groups have already begun (and therefore, which group each line entry belongs.)
I still don't understand why you 'Corrected name of Anne in Brian' and not vice versa. I guess the name to display in each group is the name of the first row in the Group (i.e. the line with the shift_start earlier).
Maybe you are looking for
-
Good day everyone, as the title said, I feel random stops with mu MBP 3.1 A couple of months, I've had a GPU problem which I fixed by replacing the motherboard with a chip 'improved '. It happens any time the battery is it not and it's the same with
-
Hello I have windows 7 Professional, and windows XP mode download, it is installed OK now won't use a printer in XP mode I have the British census of 1881 and the index of vital records, how do I install the XP mode. Spent some time according to the
-
Require BIOS 1.8 for Satellite A200 - 13M (PSAE6) - fan activity
Hi you all,. I've recently updated my Satellite A200 - 13 M (PSAE6) with 2, 20 - Win Vista bios.I have a higher activity of the fan and therefore, much more noise!The fan now comes 47-48 ° C, which is lower than earlier (~ 50 ° C). I would go back to
-
USB-6501 Z (high impedance)
I am using the IDW library to create a master by using the USB-6501. My problem is that the DAQmx write gives an error when it tries to use the 'Z' setting for high impedance. Are there workarounds for this?
-
Can not find an example for synchronization series S-6120 devices...
Hello I recently updated my system to MSstudio and NiDAQmx 8.8 8.6. I have two cards PCI 6120 on my computer. I'm looking for a sample VB .NET program for synchronization of the two cards. But I can't find examples for S material of the series. The e