Query a Table only once
Hello
I have an obligation to appoint all transactions in a store except inversions. So I wrote the query as follows
with trn as ( select 1 t_key, 1 invoice#, 'A' Client, 'P1' Product, 'N' reversal from dual union all select 2 t_key, 2 invoice#, 'B' Client, 'P1' Product, 'N' reversal from dual union all select 3 t_key, 3 invoice#, 'C' Client, 'P1' Product, 'N' reversal from dual union all select 4 t_key, 3 invoice#, 'C' Client, 'P1' Product, 'Y' reversal from dual ), rev_t as (select distinct invoice# from trn where reversal = 'Y') select * from trn where not exists (select 'x' from rev_t where rev_t.invoice# = trn.invoice#);
But in the real world scenario I table of 120 million transactions. If you notice that I consulted trn table 2 times - once in rev_t and the other in the main query. This causes a problem of enormous performance for me. Could you please suggest better otherwise if while accessing to trn don't table only once.
Use Analytics:
with NRT as)
Select 1 t_key, 1 invoice #, 'A' customer, the product "P1", "n" everyone inversion the double union
Select 2-t_key, 2 invoice #, Client "B", "P1" product, inversion of "n" of all the double union
Select 3-t_key, 3 invoice #, customer 'C', 'P1' product, inversion of "n" of all the double union
Select 4 t_key, 3 invoice #, 'C' Client, produces 'P1', 'Y' reversal of the double
),
rev_t like)
Select trn.*,
Max (case inversion when 'Y' then 1 else 0 end) on y_flag (partition of invoice #)
NRT
)
Select t_key,
Invoice #.
customer,
product,
reversal
of rev_t
where y_flag = 0
/
T_KEY INVOICE # C PR R
---------- ---------- - -- -
1 1 N P1
2 2 N P1
SQL >
And if the reversal can be only Y/N or null:
with NRT as)
Select 1 t_key, 1 invoice #, 'A' customer, the product "P1", "n" everyone inversion the double union
Select 2-t_key, 2 invoice #, Client "B", "P1" product, inversion of "n" of all the double union
Select 3-t_key, 3 invoice #, customer 'C', 'P1' product, inversion of "n" of all the double union
Select 4 t_key, 3 invoice #, 'C' Client, produces 'P1', 'Y' reversal of the double
),
rev_t like)
Select trn.*,
Max (Reversal) on y_flag (partition of invoice #)
NRT
)
Select t_key,
Invoice #.
customer,
product,
reversal
of rev_t
where y_flag = ' don't
/
SY.
Tags: Database
Similar Questions
-
Refresh table-form query on table only for pages in .jsff
I have a group being generated as a presentation of table form. I would like for the page of the table to always refresh, and submit the form to refresh page after.
I saw a thread about how to do this on a .jspx page: Refresh table-form query on table only
Unfortunately, this does not work for me because I use the .jsff pages and they do not have access to the facesContext. Does anyone know how to do this for a .jsff page?
Thank you
MichelleMichelle,
The taskflow 11 ADF in the equivalent of the region of this expression would be
#{jhsPageChanged and controllerContext.currentViewPort.viewId=='/MyGroupTaskFlow/MyGroupTable'}
Unfortunately, this currently does not work because there is an error in the JhsNavigationHandlerImpl class we're going to fix in the next release.
You can apply a work around by creating a subclass of JhsNavigationHandler and replace as follows:' public Sub handleNavigation (FacesContext facesContext, string action,
The string result)
{
String oldPageFragmentId = ControllerContext.getInstance () .getCurrentViewPort () .getViewId ();
super.handleNavigation (facesContext, action, result);
String newPageFragmentId = ControllerContext.getInstance () .getCurrentViewPort () .getViewId ();
If (! oldPageFragmentId.equals (newPageFragmentId))
{
JsfUtils.storeOnRequest (JHS_PAGE_CHANGED, Boolean.TRUE);
}
}To use your subclass, create a custom template for the facesConfig.vm and modify the navigation Manager to use your subclass.
Steven Davelaar,
JHeadstart team. -
by pushing the tables only once?
say I have a button that I push to add a term currently selected within a field of field / text entries in a table, but I don't want to accidentally add the same option twice, or see the same option again and again, what should I do for the table?
Here is the original for a table called aNameslist and a variable called namesD
addmcD.onPress = function() {}
aNameslist.push (namesD);
}What is necessary to move from an output like
Jane Doe, Jane Doe, Calaway give, John Doe, Jim Dutchy, John Doe, Jane Doe
something like
Calaway give, John Doe, Jane Doe, Jim Dutchy
?
You can remove duplicates from any array by passing to the function below:
a = removeDupsF (a);
function removeDupsF(a:Array):Array {}
for (var i = a.length - 1; i > = 0; i--) {}
for (var j = i-1; j > = 0; j-) {}
{if(a[i]==a[j])}
a.splice (i, 1);
break;
}
}
}
return a;
}
-
Haw to find the element in the table that appears only once
I have a table like this 2d:
1 2 3 4 5 0
5 6 2 4 7 2
8 3 6 0 9 4
5 6 7 7 3 2
And I need to find items that appear only once in this table
In this case, 8 and 9
I also need this elements (row and column) position
Are integers
I tried to remodel the table and use the find but no result.
Your best bet is to remodel a table 1 d do your seaching and use 'Quotient & rest' to convert location (index) in the table 1 d back to the index in table 2D. Use "Array Size" to get the number of rows and columns of the table 2D.
The histogram only works on 1 d arrays.
Or reshape a 1 d table. For each digit (0-9), use 'Search 1 D Array' twice. If the first 'search' finds a match (does not =-1), use the offset to start the 2nd search beyond the 1st index discovery. If 2nd 'search' returns-1, then one and the SAME time happens
The index of the first 'search' to calculate the index (Quotient & rest") line and collar of the 2D array.
-
SQL Query - where where cause exists only once...?
I have a query/set result that I'm trying to / query filter.
What I need is, in two of the 5 columns in the result set, I need to return where registration exists only once. The other 3, they must meet certain criteria.
So, logically, it would be true for all: give me results where results in column 1, 2 there is only once AND Column3 is null and Column3 is null, and column 5 = Server
Not sure if that sense...? :/
one
Published by: Topher34 on March 11, 2010 16:18Try this way:
SQL> select id_user 2 from tbl1 3 group by id_user 4 having count(*)=1 and max(group_name) is null and max(nm_privilege) is null; ID_USER -------------------- AR55245 ASHARMA ADENYSENKO AREEFULLAH
Your qery becomes:
with tbl1 as ( select acct.id_user,sys.system_name,sys.fl_system_type,gu.group_name,obj.nm_privilege from acct left join gu on acct.id_user=gu.grantee and acct.system_id=gu.system_id left join sys on sys.system_id=acct.system_id left join obj on obj.grantee=acct.id_user and obj.system_id=acct.system_id ) select id_user from tbl1 group by id_user having count(*)=1 and max(group_name) is null and max(nm_privilege) is null
Max
http://oracleitalia.WordPress.com -
Here's the situation:
We are repeatedly followed eight real-world signals and comparing them to a threshold value. We do this via a loop For inside a While loop. The loop For runs eight times per pass. We have implemented a binary table 1 d and the use of the index of the loop For as the array index, by putting a Boolean result in the table using the function replace table subset. We want to keep the data in the table to be 'sticky', in the sense that any True value is locked, so even if a fake comes later, this array element true. However, since we initialize the array in order for the replacement to the work table, we see that whenever the loop For again, it resets the table and destroys the history.
I have attached a simple VI to illustrate the concept, using a random number generator as a stand-in for the real world signals. How we change this VI do and entered real lock through multiples for loop runs, indefinitely?
In case it is not obvious, I am a relative beginner, so please keep count in your response.
Thank you
B
scottbbb wrote:
For B, although I love the simplicity of it, I have a question: it solves the problem of the re-initialization? What the shift of the While loop register get initialized - only once during its launch?
Yep, the shift register Initializes only at the beginning. You could say that every time the while loop is called (not each iteration) the shift register is reset with the wrong table.
And, Yes, GOLD will always keep a REAL when it is TRUE.
Usually, the simplest solution is the best.
-
I CAN QUERY A TABLE EVEN AFTER THE DELETION OF THE DATA FILE
Hello
Can someone explain to me the reason why I am able to interview some tables even after the deletion of the data that are associated with file?
SQL > select table_name, tablespace_name from dba_tables where owner = 'SCOTT ';
TABLE_NAME, TABLESPACE_NAME
------------------------------ ------------------------------
TEST2 USERS
TEST USERS
SALGRADE USERS
USERS OF BONUS
USERS OF THE EMP
USERS OF DEPT
6 selected lines.
SQL > exit
Disconnected from the database to Oracle 11 g Enterprise Edition Release 11.2.0.1.0 - Production
With partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@localhost orcl] $ rm /app/oracle/oradata/orcl/users01.dbf
[oracle@localhost orcl] $ sqlplus scott/scott
SQL * more: Production version 11.2.0.1.0 on Mon Mar 30 21:35:54 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With partitioning, OLAP, Data Mining and Real Application Testing options
SQL > select count (*) from test2;
Select count (*) from test2
*
ERROR on line 1:
ORA-01116: error opening the database file 4
ORA-01110: data file 4: ' / app/oracle/oradata/orcl/users01.dbf'
ORA-27041: could not open the file
Linux error: 2: no such file or directory
Additional information: 3
SQL > select count (*) of the test;
COUNT (*)
----------
5000
SQL >
The first output is as expected. But why am I still able to query the table of test, even if the data file has been deleted.
Hello
The process of database have a file handle for the data file - this remains even when the file is deleted (it disappears from the normal file system navigation)
You can see if you have lsof installed
just try
lsof | grep datafile_name
Once the database is restarted and the released file handle so you will not be able to do this any more - and in fact you will get errors when it can't find the file.
See you soon,.
Rich
-
Hello
I use ATG version 10.2 and you have configured CRS application by IMC. All data import and deployments have been successful.
Applications of short (MDEX 6.4.1, CASE 3.2.1 6.4.1.2, tools and Framework 3.1.2 platform services) are running: port 8006, 8500, race 8888.
Now MY PROBLEM IS in TWO PARTS:
PART 1) Ran the store on jboss, has worked well, core application started without any error. When trying to load the homepage, get following error message:
16:42:25, 926 full repository INFO [SEORepository] SQL boot
16:43:32, 653 ERROR [DynamoServlet]
CAUGHT AT:
Container: ATG.servlet.jsp.ContainerJspException: Cannot find the named component: / atg/registry/Slots/HomeTheme; Source: javax.servlet.ServletException: Cannot find the named component: / atg/registry/Slots/HomeTheme
at atg.taglib.dspjsp.ParamTag.doStartTag(ParamTag.java:419)
at org.apache.jsp.navigation.gadgets.homePagePromotions_jsp._jspx_meth_dsp_005fparam_005f0(homePagePromotions_jsp.java:1021)
at org.apache.jsp.navigation.gadgets.homePagePromotions_jsp._jspService(homePagePromotions_jsp.java:219)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:638)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:543)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:480)
at atg.servlet.WrappingRequestDispatcher.include(WrappingRequestDispatcher.java:123)
at atg.taglib.dspjsp.IncludeTag.doEndTag(IncludeTag.java:883)
at org.apache.jsp.index_jsp._jspx_meth_dsp_005finclude_005f1(index_jsp.java:633)
to org.apache.jsp.index_jsp.access$ 1 (index_jsp.java:622)
to org.apache.jsp.index_jsp$ Helper.invoke1 (index_jsp.java:685)
to org.apache.jsp.index_jsp$ Helper.invoke (index_jsp.java:711)
at org.apache.jsp.tag.web.store.pageContainer_tag._jspx_meth_c_005fwhen_005f1(pageContainer_tag.java:2757)
at org.apache.jsp.tag.web.store.pageContainer_tag.doTag(pageContainer_tag.java:812)
at org.apache.jsp.index_jsp._jspx_meth_crs_005fpageContainer_005f0(index_jsp.java:598)
at org.apache.jsp.index_jsp._jspx_meth_dsp_005fpage_005f1(index_jsp.java:565)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:127)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
...........................
...........................
...........................
...........................
At this point, the CRS page opens but no short content. Don't load no registration, no image on the home page does display, NO SEARCH BOX displayed in the header.
PART 2) On top of that when I try to run the server pubishing on JBOSS, start does'nt server and responds to error. If the das_id_generator table exists in DB for all 4 patterns.
16:09:41, 082 INFO [ScreenLog] with logging of external for debug messages and trace kernel to avoid hidden kernel logging information. Set the property /atg/dynamo/service/logging/ScreenLog.useInfoForDebug to false nucleus to use external instead trace and debug logging.
16:09:41, 199 INFO [Version] HV000001: Hibernate Validator 4.3.1.Final
16:09:41, 748 Truncating WARN [ClusterBroadcaster] serviceProperties "commandLineModules" key value
16:09:42, size INFO [STDOUT] 345 (ERR_QUERY_TABLE, das_id_generator
16:09:42, 351 ERROR [IdGenerator]
CAUGHT AT:
Container: ATG.service.IdGen.IdGeneratorException; Source: Container: ATG.service.IdGen.IdGeneratorException: Cannot query the table 'das_id_generator '. Please make sure that the table exists and is accessible before you start this service. ; Source: Java.Sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
at atg.service.idgen.PersistentIdGenerator.initialize(PersistentIdGenerator.java:389)
at atg.service.idgen.AbstractSequentialIdGenerator.doStartService(AbstractSequentialIdGenerator.java:643)
at atg.nucleus.GenericService.startService(GenericService.java:561)
at atg.nucleus.NucleusNameResolver.startService(NucleusNameResolver.java:1726)
at atg.nucleus.NucleusNameResolver.configureAndStartService(NucleusNameResolver.java:1397)
at atg.nucleus.NucleusNameResolver.createFromName(NucleusNameResolver.java:928)
at atg.nucleus.NucleusNameResolver.createFromName(NucleusNameResolver.java:667)
at atg.nucleus.NucleusNameResolver.createFromName(NucleusNameResolver.java:648)
at atg.nucleus.NucleusNameResolver.resolveName(NucleusNameResolver.java:493)
at atg.nucleus.ConfigurationRef.getValue(ConfigurationRef.java:119)
at atg.nucleus.SimpleComponentState.setBeanProperty(SimpleComponentState.java:403)
at atg.nucleus.SimpleConfigurationState.saveToBean(SimpleConfigurationState.java:240)
at atg.nucleus.SimpleConfigurationState.configureBean(SimpleConfigurationState.java:263)
at atg.nucleus.BeanConfigurator.configureBean(BeanConfigurator.java:297)
at atg.nucleus.PropertyConfiguration.configureService(PropertyConfiguration.java:984)
at atg.nucleus.SingleNucleusConfigurator.configureService(SingleNucleusConfigurator.java:84)
at atg.nucleus.NucleusNameResolver.configureService(NucleusNameResolver.java:1643)
at atg.nucleus.NucleusNameResolver.configureAndStartService(NucleusNameResolver.java:1368)
........................
........................
........................
An early response would be really useful because we have demo in 10 days.
Kind regards
Ben Milot
Thank you for this comment.
I had created a fresh scheme for publication but the jboss was still pointing to the old.
I've updated this pointers in file @ /server/
atg atg - ds - ds.xml. Worked like a charm! If 2nd EDITION solved.
The QUESTION 1 depended on question 2. Once I ran publishing and completed the full deployment on ICC, 1st edition got resolved.
Thanks to shaik and Grando
Kind regards
Ben Milot
-
A query to extract only the non-null columns.
Hello
I have a table with:
COLA, COLB TEACHERS COLD COLE
AA BB < null > < null > JJ
< Null > < null > CC < null > EE
I need a query that retrieves only 1 rows like this:
COLA, COLB TEACHERS COLD COLE
AA BB CC DD EE
My version of the database is 11.2
Thnak you
odd design but in this case, you could go with MAX (or MIN)
HTH
-
How to write a hierarchical query so that only the child nodes are displayed?
Hi all
I have a hierarchical query that I use in an area of tree demand APEX and there are nodes that have no children and I am trying to find a way to not display these nodes. Essentially if the user does not have to develop a lot of knots to know that nothing exists at the most detailed level.
The data are based on the Oracle Fusion FND tables but for example purposes here is enough data to illustrate my question:
create table APPL_TAXONOMY_HIERARCHY (SOURCE_MODULE_ID varchar2(30), TARGET_MODULE_ID varchar2(30)); create table APPL_TAXONOMY_TL (module_id varchar2(30), description varchar2(100), user_module_name varchar2(30), language varchar2(5)); create table APPL_TAXONOMY (MODULE_ID varchar2(30), MODULE_NAME varchar2(30), MODULE_TYPE varchar2(10), MODULE_KEY varchar2(30)); create table TABLES (table_name varchar2(30), module_key varchar2(30));
insert into APPL_TAXONOMY_TL values ('1', null, 'Oracle Fusion', 'US' ); insert into APPL_TAXONOMY_TL values ('2', null, 'Financials', 'US' ); insert into APPL_TAXONOMY_TL values ('3', null, 'Human Resources', 'US' ); insert into APPL_TAXONOMY_TL values ('20', null, 'Accounts Payable', 'US' ); insert into APPL_TAXONOMY_TL values ('10', null, 'General Ledger', 'US' ); insert into APPL_TAXONOMY_HIERARCHY values ('1', 'DDDDDDDD'); insert into APPL_TAXONOMY_HIERARCHY values ('2', '1'); insert into APPL_TAXONOMY_HIERARCHY values ('3', '1'); insert into APPL_TAXONOMY_HIERARCHY values ('4', '1'); insert into APPL_TAXONOMY_HIERARCHY values ('10', '2'); insert into APPL_TAXONOMY_HIERARCHY values ('20', '2'); insert into APPL_TAXONOMY values ('1', 'Fusion', 'PROD', 'Fusion'); insert into APPL_TAXONOMY values ('2', 'Financials', 'FAMILY', 'FIN'); insert into APPL_TAXONOMY values ('10', 'GL', 'APP', 'GL'); insert into APPL_TAXONOMY values ('3', 'Human Resources', 'FAMILY', 'HR'); insert into APPL_TAXONOMY values ('20', 'AP', 'APP', 'AP'); insert into tables values ('GL_JE_SOURCES_TL','GL'); insert into tables values ('GL_JE_CATEGORIES','GL');
My hierarchical query is as follows:
with MODULES as ( SELECT h.source_module_id, b.user_module_name, h.target_module_id FROM APPL_TAXONOMY_HIERARCHY H, APPL_TAXONOMY_TL B, APPL_TAXONOMY VL where H.source_module_id = b.module_id and b.module_id = vl.module_id and vl.module_type not in ('PAGE', 'LBA') UNION ALL select distinct table_name, table_name, regexp_substr(table_name,'[^_]+',1,1) from TABLES --needed as a link between TABLES and APPL_TAXONOMY union all select module_key as source_module_id, module_name as user_module_name, module_id as target_module_id from appl_taxonomy VL where VL.module_type = 'APP') SELECT case when connect_by_isleaf = 1 then 0 when level = 1 then 1 else -1 end as status, LEVEL, user_module_name as title, null as icon, ltrim(user_module_name, ' ') as value, null as tooltip, null as link FROM MODULES START WITH source_module_id = '1' CONNECT BY PRIOR source_module_id = target_module_id ORDER SIBLINGS BY user_module_name;
In Oracle APEX, this gives a tree with the appropriate data, you can see here:
https://Apex.Oracle.com/pls/Apex/f?p=32581:29 (username: guest, pw: app_1000);
The SQL of the query results are:
STATUS TITLE LEVEL VALUE ---------- ---------- ------------------------------ ------------------------------
1 1 oracle Fusion Oracle Fusion -1 2 financial tables Financials -1 3 accounts payable Accounts payable 0 4 AP AP -1 General Accounting 3 General Accounting -1 4 GL GL 0 5 GL_JE_CATEGORIES GL_JE_CATEGORIES 0 5 GL_JE_SOURCES_TL GL_JE_SOURCES_TL 0 2 human resources Human resources The lowest level is the name of the table to level 5. HR is not any level under level 2, in the same way, "AP" (level 4) has nothing below, i.e. no level 5 and that's why I don't want to show these nodes. Is this possible with the above query?
Thanks in advance for your suggestions!
John
Hello
The following query will include only the nodes of level = 5 and their ancestors (or descendants):
WITH modules LIKE
(
SELECT h.source_module_id
b.user_module_name AS the title
h.target_module_id
To appl_taxonomy_hierarchy:
appl_taxonomy_tl b
appl_taxonomy vl
WHERE h.source_module_id = b.module_id
AND b.module_id = vl.module_id
AND vl.module_type NOT IN ('PAGE', "LBA")
UNION ALL
SELECT DISTINCT
table-name
table_name
, REGEXP_SUBSTR (table_name, ' [^ _] +')
From the tables - required as a link between the TABLES and APPL_TAXONOMY
UNION ALL
SELECT module_key AS source_module_id
AS user_module_name module_name
module_id AS target_module_id
Of appl_taxonomy vl
WHERE vl.module_type = 'APP '.
)
connect_by_results AS
(
SELECT THE CHECK BOX
WHEN CONNECT_BY_ISLEAF = 1 THEN 0
WHEN LEVEL = 1 THEN 1
OF ANOTHER-1
The END as status
LEVEL AS lvl
title
-, NULL AS icon
, LTRIM (title, "") AS the value
-, NULL as ToolTip
-, Link AS NULL
source_module_id
SYS_CONNECT_BY_PATH (source_module_id - or something unique
, ' ~' - or anything else that may occur in the unique key
) || ' ~' AS the path
ROWNUM AS sort_key
Modules
START WITH source_module_id = '1'
CONNECT BY PRIOR Source_module_id = target_module_id
Brothers and SŒURS of ORDER BY title
)
SELECT the status, lvl, title, value
-, icon, tooltip, link
OF connect_by_results m
WHEN THERE IS)
SELECT 1
OF connect_by_results
WHERE the lvl = 5
AND the path AS ' % ~' | m.source_module_id
|| '~%'
)
ORDER BY sort_key
;
You may notice that subqueries modules and the connect_by_results are essentially what you've posted originally. What was the main request is now called connect_by_results, and it has a couple of additional columns that are necessary in the new main request or the EXISTS subquery.
However, I am suspicious of the 'magic number' 5. Could you have a situation where the sheets you are interested in can be a different levels (for example, some level = 5 and then some, into another branch of the tree, at the LEVEL = 6, or 7 or 4)? If so, post an example. You have need of a Query of Yo-Yo, where you do a bottom-up CONNECT BY query to get the universe of interest, and then make a descendant CONNECT BY query on this set of results.
-
Help with the query to select only one record from the result set in double
Hello
Please help with the query. Version of Oracle database we use is 10g R2.
I have a vision that is duplicated IDS, but they are used across the different functions. See below examples of data. Please help me with a query to select only one record (based on ID regardless of the area) from the bottom of the result set of duplicate records. For what is the point of view is there unique records, given the combination of the fields ID, Org, DF, dry, Sub-Sec
ID Org DF Sec Sub-Sec (163) CQ CPDM CPDM HD (163) PC ENG ENG ENG (163) CQ ASIC ASIC IS 8888 TS TAC TAC TAC (163) TS HE HE SW 6789 CQ INFO INFO FOS 6789 PC SECSYS SECSYS INFO1 6789 TS SECSYS SECSYS INFO2 9009 PC BMS BMS BMS1 My result set must eliminate the duplicate identifiers regardless of whoever we choose of the result set. (I mean without distinction Org, DF, s, Sub-s). My expected result set should be.
ID DSB DF SEC Sub-Sec (163) CQ CPDM CPDM HD 8888 TS TAC TAC TAC 6789 CQ INFO INFO FOS 9009 PC BMS BMS BMS1 Thank you
Orton
Hello
This sounds like a job for ROW_NUMBER:
WITH got_r_num AS
(
SELECT id, DSB, df, s, sub_sec org
ROW_NUMBER () OVER (PARTITION BY ID.
ORDER BY org
) AS r_num
OF view_x
)
SELECT id, DSB, df, sub_sec s,
OF got_r_num
WHERE r_num = 1
;
He is a Top - N query example, where you choose the elements of N (N = 1 in this case) from the top of an ordered list.
I hope that answers your question.
If not, post a small example of data (CREATE TABLE and INSERT, only relevant columns instructions) to your sample data and the results desired from these data. (I know that you said that you were a view selection. Just for this thread, pretending it is a picture and post simple CREATE TABLE and INSERT statements to simulate your point of view).
Point where the above query is to produce erroneous results, and explain, using specific examples, how you get the right results from data provided in these places. (I didn't quite understand the explanation above. I don't know why you want toID ORG DF DRY SUB_SEC
-- --- -- --- -------
1234 CQ DPRK DPRK HD
and is not
1234 IS CQ ASIC, ASIC
or
TS 1234 IT IT SW
or
1234 CQ ASIC ASIC HD
)
If you change the query at all, post your modified version.
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
-
Show the button with a single click to edit the table only after click
Hi all
I love the click to change features in tables in the ADF and have a button in one of the columns I want to only be displayed in the mode (it is only once the user has clicked on a particular line) edition. Currently, all fields appear as read-only and can be changed when the user clicks on a line, but it seems that the button is always visible. I tried a few EL expressions to set the visible property of the button but have not found one that works. Could you help to define an EL or give me a hint on how I could hide the buttons in the table and only then display the row that is clicked and can be changed?
Thank you
Jobinesh blogged about this here decompilation binary ADF: made conditional editor components for a table of clickToEdit
Timo
-
Group of employees by Department, but show only once the dept
Hi gurus...
I have a query that returns the following result set...
DEPT # EMP #.
------------------
10 101
10 102
10 103
20 201
20 202
20 203
However, I need to have my result set as follows, i.e. present dept # only once for a list of employees in this Department...
DEPT # EMP #.
------------------
10 101
102
103
20 201
202
203
Please suggest me the functions should I use to achieve this... Appreciate your help in this reqard...
Thanks in adavance.
VivekSQL> with query as 2 ( select 10 dept#, 101 emp# from dual union all 3 select 10, 102 from dual union all 4 select 10, 103 from dual union all 5 select 20, 201 from dual union all 6 select 20, 202 from dual union all 7 select 20, 203 from dual 8 ) 9 select case row_number() over (partition by dept# order by emp#) 10 when 1 then dept# 11 else null 12 end dept# 13 , emp# 14 from query 15 / DEPT# EMP# ---------- ---------- 10 101 102 103 20 201 202 203 6 rows selected.
Kind regards
Rob. -
Need help to write a MySQL query that returns only the peer matching records
Because I don't know how to explain it easily, I use the table below as an example.
I want to create a MySQL query that returns only the records that match counterparts where 'col1' = 'ABC '.
Notice the ' ABC / GHI' record does not have a Counter-match ' GHI / ABC' record. This record must not be returned because there is no Counter-Party correspondent. With this table, the ' ABC / GHI' record should be the one returned in the query.
How can I create a query that will do it?
ID | col1 | col2
--------------------
1. ABC | DEF
2. DEF | ABC
3. ABC | IGS
4. DEF | IGS
5. IGS | DEF
* Please let me know if you have no idea of what I'm trying to explain.I wanted to just the results where col1 = ABC, but I already got the answer I needed on another forum. Thank you anyway.
SELECT a.col1,
a.col2
FROM table_name AS a
LEFT OUTER
Table_name JOIN b
ON b.col1 = a.col2
AND a.col1 = b.col2
WHERE b.col1 IS NOT NULL AND a.col1 = 'ABC '. -
Hello
I have an old Mac Mini since 2006 with the following configuration: 1, 66 GHz Intel Core Duo, running Snow Leopard 10.6
In recent months, it runs only once. I explain. If I shut it down, on reboot, I have Blue with grey wheel screen. I tried a lot of things: disc utilities, to change drive hard, fsck, verbose, single user,...
Also, I thought it was something wrong with the last 10.6 update so I have not updated it but no, same problem
The only solution, he works at each time reinstall Snow Leopard 10.6 from an external drive, it works perfectly... until the next stop.
Does anyone have an idea on how to find (and fix) this problem?
Thank you very much!
Seems that something is corrupt some files while that lead, RAM? HARD DRIVE?
1 insert the Mac OS X installation disc, and then restart the computer by pressing the C.
2 when your computer has finished booting from the disc, choose disk utility from the menu of the installer at the top of the screen. (In Mac OS X 10.4 or later, you must select your language first.)
* Important: Do not click on continue in the first screen of the installer. If you do, you must restart from the disc to access disc utilitaire.*
3. click on the tab clear.
4. click on the triangle to the left of the hard drive icon to display the names of your partitions and hard disk volumes.
5. Select your Mac OS X volume.
6. Select the disk, select the partition, then type Format... Mac OS Extended journaled, click Security Options, choose zero data, erase, one pass... after I hope you can get a good installation.
Maybe you are looking for
-
We use the El X 10.11.5 captain recently, we updated the software being offered bij Apple tot the new version of iLife Subsequently, iPhoto was not longer working, and all of our 25 000 photos have been migrated to (imported in) Photos (1.5 V). Unfor
-
2D table are displayed in a table, 1 row at the same time
I use a loop to read a serial port 40 times and display the values in a table of 40 lines and 5 columns. I have auto index out of the loop For to build the string 2D array. The problem is that the serial port takes too long to respond and the VI tak
-
HP Pavilion dv6809us entertainment notebook pc freeze
Hello! Having a problem with my Pavilion dv 6809us laptop. It freezes everything trying to get from one page to another. I can't stop or close pages. It just happens. I trided chkdsk and it gets to Chapter 4 of the 5, checks some files and then st
-
error like (Hearts.exe - invalid image) apears in any program.
After I used the audit tool to find errors in c hard disck, now, there's always displays a message telling me that the image is not valid but if I clik ok similar program open if there is no problem at all. This message apears in tha any program I tr
-
I can't find the page that shows you all the drawings that I can use as a theme.
I want to change the theme of my page but could not find your page that shows all my choices.