Need to simplify the query
Hi gurus
I have the following data:
Drop table
DROP TABLE lb_source;
DROP TABLE lb;
Insertion and table creation
CREATE TABLE lb_source
(
source_cd VARCHAR2 (5)
);
INSERT INTO lb_source
(
SELECT 'a' STARTING from two
UNION ALL
SELECT 'b' double
UNION ALL
Select 'l' to double
);
CREATE TABLE lb
(
group_number VARCHAR2 (10),
source_cd varchar2 (5)
);
INSERT INTO lb
(
SELECT '100', 'l' FROM dual
UNION ALL
SELECT '100', double null
);
------------
If you see table lb then it contained a line with source_cd = l against 100 and source_cd = Null group against group 100, now I want to create this kind of query, in which all correspondence lines in tables to join both if lb is null, then query join all the source_cd of table lb_source except source_cd = 'l '. So far, I created the following query and its works ok but I want to do all my work in one in where condition...
Query
SELECT * FROM
(
SELECT s1, s2 b.source_cd A.source_cd
OF lb_source A
lb b
WHERE A.source_cd = nvl (b.source_cd, A.source_cd)
)
WHERE s2 IS NULL
;
Result
s1 s2
a null value
b zero
l null
Please guide
Hello
So, you want something that produces the same accurate results as the query you posted, but does more just; Isn't it?
Here's one way:
SELECT ls.source_cd S1
NULL AS s2
OF ls lb_source
JOIN lb l WE l.source_cd IS NULL
AND ls.source_cd IS NOT NULL;
I'm curious; What is the business problem that requires this request? What tables and columns represent, and what tell you the query?
Thanks for posting the CREATE TABLE and INSERT statements; It's very useful!
Tags: Database
Similar Questions
-
Extend the VO - need to change the query of VO - screen is off
{Re-post the message in this forum (thanks to John Stegeman to lead me here...) {Posted: August 28, 2009 04:27}
Dear all,
Thanks to this great body of knowledge, I ask my questions.
I need to extend a VO to display the name of the country.
The column is not in the VO. So, I need to get another table: FndTerritories
I want to change the query, but the request frame is turned off (in the wizard the View - step 5 of 6 - Generated statement object substitution)
Could you be it someone please let me know: how to change the application of the VO in this case?
OR is there another solution for such cases, to maintain development standards
Thank you very much
Kind regardsHello
I think that's when you just have to add an attribute, you should not click the expert mode checkbox... make use of
Mix and add the button.But when you need to modify the query, and then we want to use to modify the query window...
Thank you
Gerard -
Need help with the query to get the County
Hello
Oracle 10 g 2 10.2.0.3 - 64 bit
I want back the number of accounts with two different types of funds (say A and B). Some accounts hold only one of the two funds, and some support both. I want to get the counts like this:
- account held funds - has only
- accounts holding funds-B only
- accounts holding the Fund-A and B funds
Here is what I started with but need assistance to meet the requirement above:
select count(distinct acct.bkoff_acct_no ) accounts_holding_fund_A from xe_account acct, xec_tal_investment_mandate iman, xec_tal_asset_allocation alloc, xe_benchmark bmark, xe_benchmark_usage bu, xe_object_description xod, xec_asset_class cls where iman.mandate_status_cd='A' and cls.asset_class_cd = alloc.asset_class_cd and iman.mandate_id = alloc.mandate_id and acct.account_id = iman.object_id and iman.object_type_cd = 'ACCT' and iman.mandate_id = xod.object_id and xod.field_nm='XEC_TAL_INVESTMENT_MANDATE.COMMENT_TXT' and xod.language_cd = 'E' and acct.acct_status_cd = 'O' and bu.object_type_cd(+) = 'TMAA' and bu.object_id(+) = alloc.asset_allocation_id and bmark.benchmark_id(+) = bu.benchmark_id and alloc.resp_txt like '%fund-A%'
And suppose that the Fund-B has resp_txt like ' % of Fund-B»
Please suggest.
Concerning
Hello
Here is another way, it is easier to adapt to different jobs and different numbers of jobs:
WITH got_distinct_jobs AS
(
SELECT DISTINCT deptno, job
FROM scott.emp
WHERE job IN ("ANALYST", "CLERKS") - or what
)
got_job_list AS
(
SELECT LISTAGG (job, ",") THE Group (ORDER BY work) AS job_list
OF got_distinct_jobs
GROUP BY deptno
)
SELECT job_list
COUNT (*) AS num_departments
OF got_job_list
GROUP BY job_list
;
This shows all the combinations of the jobs listed in the WHERE clause of got_distinct_jobs. You don't need to change anything else in the query. There may be any number of jobs.
Output:
JOB_LIST NUM_DEPARTMENTS
------------------------------ ---------------
CLERK 2
ANALYST, CLERK 1
-
Need help with the query (transpose)
Hello experts, please help here - 11 g Oracle, attribute APA APB are fixed values and can be hard coded in query
Need to transpose these data. Max(decode.. perd les données en sortie à cause de la condition de Max.)
Entry:
Name | Attribute | Value
A1 APP 10
A1 PDB 11
A1 APA 20
A1 PDB 21
A2 BPA 13
A2 BPB 14
Expected results:
Name AttVal1 AttVal2
A1 10 11
13 14 A2
20 21 A1
Hello
Here's one way:
WITH relevant_columns AS
(
SELECT name
value
CASE
WHEN the attribute ("APA", "BPA") THEN 1
WHEN the attribute ("PDB", "BPB") THEN 2
END AS c_num
ROW_NUMBER () (PARTITION BY NAME, attirbute
Value of ORDER BY
) AS r_num
FROM table_x
)
SELECT name, attval1, attval2
OF relevant_columns
PIVOT (MAX (value)
FOR c_num IN (1 AS attval1
2 UNDER attval2
)
)
ORDER BY r_num, name
;
If you would care to post CREATE TABLE and INSERT statements for your sample data, and then I could test this.
Why do you want to
NAME ATTVAL1 ATTVAL2
---- ------- -------
A1 10 11
20 21 A1
in the results, rather than
NAME ATTVAL1 ATTVAL2
---- ------- -------
10 21 A1
20 11-A1
? You would be satisfied to one or the other?
Depending on your answer, you may need to modify the analytical ORDER BY clause in the ROW_NUMBER function.
-
Need help with the query. Help, please
Hey everyone, need your help. Thank you in advance. In my view, there is function Pivot. Just do not know how to use this function. I have the query that works. The result is:
11-111-1111 Vlad 16505 01/04/2013 5 August 13 dental plan pre-tax amount 29,65
11-111-1111 Vlad 16505 01/04/2013 dental pre-tax 5 August 13 Plan level EE + SP
11-111-1111 16505 Vlad 01/04/2013 5 August 13 pre-tax Option TOP dental plan
11-111-1111 Vlad 16505 01/04/2013 5 August 13 pre-tax dental care plan pay the value
11-111-1111 16505 Vlad 01/04/2013 dental pre-tax 5 August 13 Plan period Type
11-111-1111 Vlad 16505 01/04/2013 amount pre-tax medical Plan of 5 August 13 149
11-111-1111 Vlad 16505 01/04/2013 5 August 13 pre-tax Medical Plan level EE + SP
11-111-1111 Vlad 16505 01/04/2013 5 August 13 pre-tax Plan medical Option MED
11-111-1111 Vlad 16505 01/04/2013 5 August 13 plan pre-tax pay value
11-111-1111 16505 Vlad 01/04/2013 5 August 13 pre-tax Medical Plan period Type
11-111-1111 Vlad 16505 01/04/2013 5 August 13 pre-tax Plan PPO medical Plan
11-111-1111 Vlad 16505 01/04/2013 5 August 13 Vision Plan amount 5.94 pre-tax
But I need the result to be
Amount of SSN ID name item level Option PayValue period Type
11-111-1111 Vlad 16505 01/04/2013 null null high of 5 August 13 pre-tax Dental Plan 29,65 EE + SP
11-111-1111 Vlad 16505 01/04/2013 null null MED 5 August 13 149 medical plan pre-tax EE + SP
11-111-1111 Vlad 16505 01/04/2013 Vision Plan before taxes of 5 August 13
Select distinct
' 11-111-1111 "as ssn,
WOMEN'S WEAR. Employee_number,
"Vlad" as EMPLOYEE_FULL_NAME,
TO_CHAR (papf.start_date, "MM/DD/YYYY") as Date_Of_Hire
a.effective_start_date,
PETF.element_name,
pivf. Name,
peevf.screen_entry_valueOf
PER_all_PEOPLE_F women's wear
per_assignments_f A
pay_element_types_f petf
pay_element_links_f pelf
PAY_ELEMENT_ENTRIES_F penf
PAY_ELEMENT_ENTRY_VALUES_F peevf
pay_input_values_f pivf
WHERE
PETF.element_name ('Dental Plan before taxes', 'Medical Plan before taxes', "Vision Plan before taxes")
and petf. ELEMENT_TYPE_ID = pelf. ELEMENT_TYPE_ID
and (trunc (sysdate) BETWEEN pelf. EFFECTIVE_START_DATE AND pelf. EFFECTIVE_END_DATE)
and (pelf. ELEMENT_LINK_ID = penf. ELEMENT_LINK_ID and a.assignment_id = penf. ASSIGNMENT_ID)
and (trunc (sysdate) BETWEEN penf. EFFECTIVE_START_DATE AND penf. EFFECTIVE_END_DATE)
and penf. ELEMENT_ENTRY_ID = peevf. ELEMENT_ENTRY_ID
and peevf. INPUT_VALUE_ID = pivf. INPUT_VALUE_ID
AND papf.employee_number IS NOT NULL
AND A.assignment_type = 'E '.
AND A.person_id = papf.person_id
and papf.effective_end_date > sysdate
and a.effective_end_date > sysdate
and (trunc (sysdate) BETWEEN women's wear. EFFECTIVE_START_DATE AND women's wear. EFFECTIVE_END_DATE)
and a.effective_start_date = (select MAX (effective_start_date) from PER_ASSIGNMENTS_f where assignment_id = a.assignment_id)
and a.assignment_id = 42643
and a.assignment_status_type_id = '1'
order of petf.element_name;Change with your query
SELECT * FROM (select distinct)
' 11-111-1111 "as ssn,
WOMEN'S WEAR. Employee_number,
"Vlad" as employee_full_name,
TO_CHAR (papf.start_date, "MM/DD/YYYY") as date_of_hire
a.effective_start_date,
PETF.element_name,
pivf. Name,
peevf.screen_entry_value
Of
PER_all_PEOPLE_F women's wear
per_assignments_f A
pay_element_types_f petf
pay_element_links_f pelf
PAY_ELEMENT_ENTRIES_F penf
PAY_ELEMENT_ENTRY_VALUES_F peevf
pay_input_values_f pivf
WHERE
PETF.element_name ('Dental Plan before taxes', 'Medical Plan before taxes', "Vision Plan before taxes")
and petf. ELEMENT_TYPE_ID = pelf. ELEMENT_TYPE_ID
and (trunc (sysdate) BETWEEN pelf. EFFECTIVE_START_DATE AND pelf. EFFECTIVE_END_DATE)
and (pelf. ELEMENT_LINK_ID = penf. ELEMENT_LINK_ID and a.assignment_id = penf. ASSIGNMENT_ID)
and (trunc (sysdate) BETWEEN penf. EFFECTIVE_START_DATE AND penf. EFFECTIVE_END_DATE)
and penf. ELEMENT_ENTRY_ID = peevf. ELEMENT_ENTRY_ID
and peevf. INPUT_VALUE_ID = pivf. INPUT_VALUE_ID
AND papf.employee_number IS NOT NULL
AND A.assignment_type = 'E '.
AND A.person_id = papf.person_id
and papf.effective_end_date > sysdate
and a.effective_end_date > sysdate
and (trunc (sysdate) BETWEEN women's wear. EFFECTIVE_START_DATE AND women's wear. EFFECTIVE_END_DATE)
and a.effective_start_date = (select MAX (effective_start_date) from PER_ASSIGNMENTS_f where assignment_id = a.assignment_id)
and a.assignment_id = 42643
and a.assignment_status_type_id = '1')
PIVOT (MAX (screen_entry_value) FOR (name) TO ("Amount" AS 'Amount', 'level' AS 'level', 'Option High' AS 'High Option', 'Pay the value' AS 'Value to pay', 'Period of Type' AS 'Type period'))
order by element_name;
(GOLD)
SELECT ssn,
Employee_number,
employee_full_name,
date_of_hire,
effective_start_date,
element_name,
Max (decode (Name, 'Amount', screen_entry_value)) 'amount. "
Max (decode (Name, 'Level', screen_entry_value)) 'level ',.
MAX (DECODE (name, "High Option", screen_entry_value)) "High Option",
MAX (DECODE (name, 'Value of pay', screen_entry_value)) 'value of pay. "
MAX (DECODE (name, 'Period Type', screen_entry_value)) 'period of Type '.
FROM (select distinct)
' 11-111-1111 "as ssn,
WOMEN'S WEAR. Employee_number,
"Vlad" as employee_full_name,
TO_CHAR (papf.start_date, "MM/DD/YYYY") as date_of_hire
a.effective_start_date,
PETF.element_name,
pivf. Name,
peevf.screen_entry_value
Of
PER_all_PEOPLE_F women's wear
per_assignments_f A
pay_element_types_f petf
pay_element_links_f pelf
PAY_ELEMENT_ENTRIES_F penf
PAY_ELEMENT_ENTRY_VALUES_F peevf
pay_input_values_f pivf
WHERE
PETF.element_name ('Dental Plan before taxes', 'Medical Plan before taxes', "Vision Plan before taxes")
and petf. ELEMENT_TYPE_ID = pelf. ELEMENT_TYPE_ID
and (trunc (sysdate) BETWEEN pelf. EFFECTIVE_START_DATE AND pelf. EFFECTIVE_END_DATE)
and (pelf. ELEMENT_LINK_ID = penf. ELEMENT_LINK_ID and a.assignment_id = penf. ASSIGNMENT_ID)
and (trunc (sysdate) BETWEEN penf. EFFECTIVE_START_DATE AND penf. EFFECTIVE_END_DATE)
and penf. ELEMENT_ENTRY_ID = peevf. ELEMENT_ENTRY_ID
and peevf. INPUT_VALUE_ID = pivf. INPUT_VALUE_ID
AND papf.employee_number IS NOT NULL
AND A.assignment_type = 'E '.
AND A.person_id = papf.person_id
and papf.effective_end_date > sysdate
and a.effective_end_date > sysdate
and (trunc (sysdate) BETWEEN women's wear. EFFECTIVE_START_DATE AND women's wear. EFFECTIVE_END_DATE)
and a.effective_start_date = (select MAX (effective_start_date) from PER_ASSIGNMENTS_f where assignment_id = a.assignment_id)
and a.assignment_id = 42643
and a.assignment_status_type_id = '1')
GROUP BY ssn, employee_number, employee_full_name, date_of_hire, effective_start_date, NOM_ELEMENT
order by element_name;
-
need help with the query, thx
Hello
I need a little help with the query I have to write;
the table has 4 columns:
what I am asking is the following result: salary according to the latest available yearcol1 col2 col3 col4 emp_name empl_id salary year content of data: col1 col2 col3 col4 smith 12 1200 1999 smith 12 1340 2000 smith 12 1500 2001 jones 13 1550 1999 jones 13 1600 2000 aron 14 1200 2002
i.e.
ID appreciate some guidance on how to achievesmith 12 1500 2001 jones 13 1600 2000 aron 14 1200 2002
Thank you
Rgdsselect *from (select col1, col2,col3, col4,row_number() over(partition by col1 order by col4 desc) rn from
) where rn=1 -
Need help in the query.
with t as
(
Select 'AAA', 'AAA01' wers_feature_code of all family_code the double union
Select 'AAA', 'AAA02' from dual union all
Select "BBB-", 'BBB01' from dual union all
Select "BBB-", 'BBB02' from dual
)
Select t1.wers_feature_code. T t1, t t2 T2.wers_feature_code
Result:
T1. WERS_FE
--------------------------------------------------------------------------------
AAA01AAA01
AAA01AAA02
AAA01BBB01
AAA01BBB02
AAA02AAA01
AAA02AAA02
AAA02BBB01
AAA02BBB02
BBB01AAA01
BBB01AAA02
BBB01BBB01
T1. WERS_FE
--------------------------------------------------------------------------------
BBB01BBB02
BBB02AAA01
BBB02AAA02
BBB02BBB01
BBB02BBB02
The above query should be filtered. The above documents not family_code even.
For example AAA01AAA01, AAA01AAA02, AAA02AAA01, AAA02AAA02, BBB01BBB01, BBB02BBB01,
BBB02BBB02 should not be visible. The code is not difficult family_code in the query. Can be more than a family_code.
Thank you
VinodhHi, Vinodh,
That's what you asked for:
WITH got_family_cnt AS ( SELECT family_code , wers_feature_code , COUNT (DISTINCT family_code) OVER () AS family_cnt FROM sample_tbl ) SELECT REPLACE ( SYS_CONNECT_BY_PATH (wers_feature_code, '>') , '>' ) AS output FROM got_family_cnt WHERE LEVEL = family_cnt CONNECT BY NOCYCLE family_code != PRIOR family_code ;
It produces 48 lines
(2 choices for family 'AAA'
* 2 for "BBB".
* 2 for "CCC".
* 3 choices for 1 family
* 2 (2nd).This assumes you know some substring that never happens in wers_feature_code. I used ' > ' above, but you can use anything else.
Published by: Frank Kulash, June 15, 2010 10:42
Simplified query. -
Simplify the query by using Analytics
Hi gurus,
I need to humiliate you help by simplifying the application, as shown below:
with REC_GRP_CNT as (select round (count (*) / 3) HML_CNT of JJVC_ACTIVITY_FREQ_RECENCY).
REC_RANK as
(select a.*, rownum rn of)
Select custid, ((total_edm_opened/total_edm_delivered) * 100) percentage from JJVC_ACTIVITY_FREQ_RECENCY by 2 desc) a).
FREQUENCY_HIGH like)
Select custid, 'H' rec_rank FREQUENCY_RANK where rn < = (select HML_CNT FROM REC_GRP_CNT)).
FREQUENCY_MEDIUM like)
Select custid, I ' rec_rank a FREQUENCY_RANK
where
not exist (select custid from b FREQUENCY_HIGH where b.custid = a.custid)
and rn < = (select HML_CNT * FROM REC_GRP_CNT 2)).
FREQUENCY_LOW like)
Select custid, 'L' rec_rank a FREQUENCY_RANK
where
not exists(select * from)
(select custid from FREQUENCY_HIGH
Union of all the
custid SELECT of FREQUENCY_MEDIUM p) WHERE the p.custid = a.custid)
and rn > = (select HML_CNT * 2 OF REC_GRP_CNT))
Select * from FREQUENCY_HIGH
Union of all the
Select * from FREQUENCY_MEDIUM
Union of all the
Select * from FREQUENCY_LOW
Thanks in advance,
BTFYou are going to have to explain what you mean by
Total records H=33.3%
Total records M=33.3%
Total records L=33.4%What criteria do you use to create these "buckets" that fall under the data?
-
Hi all
I update a table using the loop... but its taking too much time.
I think to update this table using the single update statement... How can I write a single update statement.
Below you will find the updated my for loop:
BEGIN
for c4 to (select source_logo, news_sources a.channel_id, matched_news_industry a
where s.channel_id = a.channel_id
and a.newS_id in (select news_id was in gm_sector_activity_tracker where is_transferred = am' and news_type = "Report entry")
and a.newS_type like '% reports '.
and a.LOGO_SOURCE is null
and a.channel_id not in (6522,6835,5395)
and a.channel_id not in (select thomson_channel_id from si_portals)) loop
Update matched_news_industry
Set logo_source = c4.source_logo
where channel_id = c4.channel_id;
end loop;
Total: = SQL % ROWCOUNT;
IF Total = 0 THEN
dbms_output.put_line (' no data updates in matched_news_industry - logo_source');
ON THE OTHER
dbms_output.put_line ('Total records updated in matched_news_industry - logo_source' |)
In total);
END IF;
Total: = 0;
EXCEPTION
WHEN No_data_found THEN
dbms_output.put_line ('zero immeasurably updated in matched_news_industry - logo_source');
WHILE OTHERS THEN
dbms_output.put_line (' there was an error updating data in matched_news_industry - logo_source');
END;
Thank you
Try the query optimized below:
Fusion in matched_news_industry one
using news_sources c4
on)
a.channel_id = c4.channel_id
and a.newS_id in (select news_id was in gm_sector_activity_tracker where is_transferred = am' and news_type = "Report entry")
and a.newS_type like '% reports '.
and a.LOGO_SOURCE is null
and a.channel_id not in (6522,6835,5395)
and a.channel_id not in (select thomson_channel_id from si_portals)
)
When matched then
update set a.logo_source = c4.source_logo
-
Need help with the query logic
I have 2 tables.
Table Tb1:
THE PLAN_ID PARENT_PLAN_ID ARGUMENT
Value null P1
P1 P2
P3 P2
P4 P1
Table tb2:
THE PLAN_ID ACTIVITY_ID PICKING ARGUMENT
P2 A1 5000
P2 A2 5000
P2 A3 5000
P3 A1 10000
P3 A2 10000
P4 A1 4000
I need to find the sum of the value of reduction of the workforce for each PLAN_ID which is parent root. In the case above, this is the argument PLAN_ID P1 (WHERE PARENT_PLAN_ID IS NULL). Please note that the value of the downsizing is repeated in the tb2 table. For example, the PLAN_ID P2 argument, the value of the downsizing is 5000 and not 5000 + 5000 + 5000.
The result of the output for the above data must be
THE ARGUMENT PLAN_ID DRAWDOWN
P1 19000
Published by: user10566312 on October 30, 2012 12:30with t as ( select t1.plan_id,t1.parent_plan_id,max(t2.DRAWDOWN) DRAWDOWN from tb1 t1,tb2 t2 where t1.plan_id = t2.plan_id(+) group by t1.plan_id,t1.parent_plan_id ) select plan_id,sum(drawdown) drawdown from( select connect_by_root plan_id as plan_id, nvl(DRAWDOWN,0) DRAWDOWN from t start with parent_plan_id is null connect by parent_plan_id = prior plan_id ) group by plan_id ; PLAN_ID DRAWDOWN ------- -------- P1 19000
Published by: JAC on October 30, 2012 13:23
-
Need help with the query string manipulation
Hello
With the help of 10.1.0.4.2
Given a table called PREFIX_CODES that contains a column called PREFIX_CODE
with the following data:
PREFIX_CODE - VARCHAR2 (20)
-------------------
AAA
BENAMER
CARTER
and another table called SUBSCRIBERS with a column called SUBSCRIBER_ID
with the following data:
SUBSCRIBER_ID - VARCHAR2 (30)
---------------------
BBBB-123456
AAA-444444
DD-2222222
EEEE-888888
Is there a query that will pull all the SUBSCRIBER_ID that begin with
each of the PREFIX_CODES? The following query is not valid, but it
This will give you an idea of what I'm trying to do:
SELECT SUBSCRIBER_ID
SUBSCRIBERS
WHERE AS SUBSCRIBER_ID (SELECT PREFIX_CODE |) » %'
OF PREFIX_CODES)
Using the data from above, I would like that the query to return:
BBBB-123456
AAA-444444
Thanks for your help!Hello
Welcome to the forum!
You were on the right track. To find if a given subscriber corresponds to any prefix_code, you can do an EXISTS subquery:
SELECT subscriber_id FROM subsribers s WHERE EXISTS ( SELECT NULL FROM prefix_codes WHERE s.subscriber_id LIKE prefix_code || '%' ) ;
This will tell you if at least a prefix code. It won't tell you exactly how many, or what they were.
Your message, I'm guessing that there may be more than one, and you can deduct the subscriber_id itself, then the above query should work for you. -
Hi all
I have the below where all the WITH clause needs to separate query and SELECT article queries must be separated. Any help is very appreciated. Try SUBSTR and INSTR.
SQL query:
######################################################################
WITH
test_does1 like)
Select 'Y' in double
)
Select *.
of test_does1
UNION ALL
SELECT 'X' FROM double
UNION ALL
SELECT 'A' FROM dual
UNION ALL
WITH
test_does2 like)
Select 'Y' in double
)
Select *.
of test_does2
######################################################################
OK... Then try the below (LISTAGG will not work in oracle 10g)
-Separate with clause
SELECT DBMS_XMLGEN. CONVERT (RTRIM (XMLAGG (XMLELEMENT (E, str |)))) "UNION ALL"). " (Extract ('//Text ()')), 'UNION ALL'), 1) lsval
FROM (SELECT LEVEL, LTRIM (REPLACE (REGEXP_SUBSTR(str1,'[^,]+',1,LEVEL), CHR (10))) str)
FROM (SELECT REPLACE (' WITH test_does1 AS))
(SELECT "Y" FROM dual)
)
SELECT * from test_does1
UNION ALL
SELECT "X" FROM dual
UNION ALL
SELECT "A" dual FROM
UNION ALL
WITH test_does2 AS
(SELECT "Y" FROM dual)
)
SELECT * FROM test_does2 ',' UNION ALL ',',') str1
THE DOUBLE)
CONNECT BY LEVEL<= length(regexp_replace(str1,="" '[^,]+'))="">=>
WHERE the str AS "WITH % ';
-Select to separate
SELECT DBMS_XMLGEN. CONVERT (RTRIM (XMLAGG (XMLELEMENT (E, str |)))) "UNION ALL"). " (Extract ('//Text ()')), 'UNION ALL'), 1) lsval
FROM (SELECT LEVEL, LTRIM (REPLACE (REGEXP_SUBSTR(str1,'[^,]+',1,LEVEL), CHR (10))) str)
FROM (SELECT REPLACE (' WITH test_does1 AS))
(SELECT "Y" FROM dual)
)
SELECT * from test_does1
UNION ALL
SELECT "X" FROM dual
UNION ALL
SELECT "A" dual FROM
UNION ALL
WITH test_does2 AS
(SELECT "Y" FROM dual)
)
SELECT * FROM test_does2 ',' UNION ALL ',',') str1
THE DOUBLE)
CONNECT BY LEVEL<= length(regexp_replace(str1,="" '[^,]+'))="">=>
WHERE str AS 'CHOOSE % ';
-Unit tests
SQL > SELECT DBMS_XMLGEN. CONVERT (RTRIM (XMLAGG (XMLELEMENT (E, str |)))) "UNION ALL"). " (Extract ('//Text ()')), 'UNION ALL'), 1) lsval
2 FROM (SELECT LEVEL, LTRIM (REPLACE (REGEXP_SUBSTR(str1,'[^,]+',1,LEVEL), CHR (10))) str)
3 (SELECT REPLACE (' WITH test_does1 AS))
4 (SELECT "Y" FROM dual)
5 )
6. SELECT * FROM test_does1
7 UNION ALL
8 "X" SELECT FROM dual
9 UNION ALL
10. SELECT "A" dual FROM
11 UNION ALL
12 test_does2 WITH AS
13 (SELECT "Y" FROM dual)
14)
15 SELECT * FROM test_does2 ',' UNION ALL ',',') str1
16 DOUBLE)
17 CONNECT BY LEVEL<= length(regexp_replace(str1,="" '[^,]+'))="">=>
18. WHERE LIKE str "WITH % ';
LSVAL
--------------------------------------------------------------------------------
WITH test_does1 AS (SELECT FROM dual 'Y') SELECT * FROM test_does1 UNION ALL
WITH test_does2 AS (SELECT FROM dual 'Y') SELECT * FROM test_does2
SQL > SELECT DBMS_XMLGEN. CONVERT (RTRIM (XMLAGG (XMLELEMENT (E, str |)))) "UNION ALL"). " (Extract ('//Text ()')), 'UNION ALL'), 1) lsval
2 FROM (SELECT LEVEL, LTRIM (REPLACE (REGEXP_SUBSTR(str1,'[^,]+',1,LEVEL), CHR (10))) str)
3 (SELECT REPLACE (' WITH test_does1 AS))
4 (SELECT "Y" FROM dual)
5 )
6. SELECT * FROM test_does1
7 UNION ALL
8 "X" SELECT FROM dual
9 UNION ALL
10. SELECT "A" dual FROM
11 UNION ALL
12 test_does2 WITH AS
13 (SELECT "Y" FROM dual)
14)
15 SELECT * FROM test_does2 ',' UNION ALL ',',') str1
16 DOUBLE)
17 CONNECT BY LEVEL<= length(regexp_replace(str1,="" '[^,]+'))="">=>
18. WHERE str LIKE "SELECT % ';
LSVAL
--------------------------------------------------------------------------------
SELECT 'X' FROM dual UNION ALL SELECT 'A' double
-
LogInsight - need to 'cancel the query' button on the interactive analytical page.
Case there when we need to find some first occurrences of the event. It could be an extensive research on all the time and we want an opportunity to cancel (stop, pause) the request once it finds few results.
the function to cancel the running query exists, but you must browse the page admin for it. We need a button on the interactive analytical page.
Thank you
ildus
Hey Ildus,.
This feature exists on the page of the AI for queries that take a long time to execute (see attachment) - you must hover over an event once the results are returned to see the option (note is put in pause/resume). Looking for something else?
-
Need to execute the query twice in order to get results
I have a query in which I need to run twice in a row to obtain results. The first round returns no value and each race after which returns lines expected.
Any ideas?Champion wrote:
I have a query in which I need to run twice in a row to obtain results. The first round returns no value and each race after which returns lines expected.Any ideas?
Well, when I run a query through TOAD, SQL or SQL Developer *, it results the first time.
So what you do differently? Or are we supposed to guess forever?
{message: id = 9360002}
-
NEED HELP WITH THE QUERY, NEED MORE RECENT FILE ONLY
Hi all
That is,
I have an assignment I need to find agents that allow players to break the rules.
So far, I have 41 results, in which there are 4 principles and 24 footballers and football player even beat more than one rule or the rule more than once.
What I need now is to make arrangements so that every footballer appears once n matter how many times they have broken the rules.
I have
SELECT
t.transfer_time | ' ' || a.first_name | ' ' || a.last_name | ' ' || f.first_name | ' ' || f.last_name | ' ' || f.footballer_id | ' ' || t.transfer_id
Of
agents a, t transfers, footballers f, footballers_fees fo
WHERE
a.agent_id = t.broker_id
AND
t.footballer_id = f.footballer_id
AND
f.footballer_id = fo.footballer_id
AND
(RULE 1 BROKEN AND RULE 2 BROKEN
OR
RULE 1 BROKEN AND ARTICLE 2 DOES NOT DECOMPOSE
OR
RULE 1 DOES NOT DECOMPOSE AND RULE 2 BROKEN)
GROUP BY
t.transfer_time | ' ' || a.first_name | ' ' || a.last_name | ' ' || f.first_name | ' ' || f.last_name | ' ' || f.footballer_id | ' ' || t.transfer_id
ORDER BY
t.transfer_time | ' ' || a.first_name | ' ' || a.last_name | ' ' || f.first_name | ' ' || f.last_name | ' ' || f.footballer_id | ' ' || t.transfer_id
;
(I did not type the SQL code to rules 1 and 2 but I know it works)
Now, I need not to show that every footballer once they broke rule and more than once or not.
I was looking at the screen nearly enough hours 10 and any help or ideas would be greatly appreciated
Thank you all :)Hello
Welcome to the forum!
Whenever you have a problem, please post a small example of data (CREATE TABLE and INSERT statements) so that people who want to help you can recreate the problem and test their ideas. You don't have to display a large amount of data. In this case, it seems that 2 to 10 lines for each table could give a good picture of the problem.
After the results that you want samples fropm, and explain how you get those resulting from these data.
Always tell what version of Oracle you are using.The ideal outcome would be just what you '; Re I get now, but with some deleted rows and only 1 line by left footballer? If so, do a subquery on the original query, and then add somehting like
, ROW_NUMBER () OVER (PARTITION BY f.footballer_id ORDER BY NULL) AS r_num
in the SELECT clause.
then, in the main query, display only linesWHERE r_num = 1
ROW_NUMBER requires an ORDER byclause of analytics. If you ORDER BY a constant (e.g. NULL) then what line gets number 1 will be arbitrary. If you care who lines for a given player is numbered 1 (and therefore included in the final output), then adjust the analytical ORDER BY clause. (You the title mentions "most recent record only", so if the dt column indicates whether a line is "newer" than another, you can "ORDER BY dt DESC".)
I know this response is vague in places. Without a concrete example (CREATE TABLE and instructions INSERT for examples of data and outcomes from these data), that's the best I can do.
Maybe you are looking for
-
Satego X 200 - 21U - only black screen on startup
Hello I am owner of a SATEGO x 200-21 U with geforce 8700 m GT. The last time I used it, it freezes within windows. Just the backlight lights up after reboot. I have no picture, just black screen. Even the Toshiba sign at the start of the laptop, the
-
old downloaded upgrade windows
I downloaded 533 upgrades of windows that looks like he never all prerequisite downloads to clear so it takes a lot of space on the computer, how or what can be done to clear the old updates or unnecessary is a windows tool or something that you can
-
Activate the AHCI on ENVY HP dv7-7304tx for the optimization of SSD
I have a HP ENVY dv7-7304tx now successfully performed an 840 Samsung SSD as drive Evo. The second disc is the original disk of spinning. Software Samsung magician tells me I need to enable the AHCI (which is not possible in the BIOS) mode to optimiz
-
increase the volume creates high reverberation as pitch
increase the volume creates reverberation as high tone sound, what happened all of a sudden andnothing I actually disappear unless I lower the volume. Windows Vista acer aspire 3680, no problem in three years of use.
-
My battery icon on the lower right part of the screen indicates that the battery is "plugged in, load", but the percentage will not exceed 14% Help, please!