find the lines without a match in the table.
Hello guys I need a little help to write a sql statement that recalls the lines that do not have a corresponding negative number corresponding, essentially based on my_id, report_id.
Here's the statement from table to better understand.
CREATE TABLE ."TEST" ( "REPORT_ID" VARCHAR2(100 BYTE), "AMOUNT" NUMBER(17,2), "MY_ID" VARCHAR2(30 BYTE), "FUND" VARCHAR2(20 BYTE), "ORG" VARCHAR2(20 BYTE) )
Some examples of data.
REM INSERTING into TEST SET DEFINE OFF; Insert into TEST (REPORT_ID,AMOUNT,MY_ID,FUND,ORG) values ('1',50,'910','100000','67120'); Insert into TEST (REPORT_ID,AMOUNT,MY_ID,FUND,ORG) values ('1',-50,'910','100000','67130'); Insert into TEST (REPORT_ID,AMOUNT,MY_ID,FUND,ORG) values ('1',100,'910','100000','67150'); Insert into TEST (REPORT_ID,AMOUNT,MY_ID,FUND,ORG) values ('2',200,'910','100000','67130'); Insert into TEST (REPORT_ID,AMOUNT,MY_ID,FUND,ORG) values ('2',-200,'910','100000','67120'); Insert into TEST (REPORT_ID,AMOUNT,MY_ID,FUND,ORG) values ('1',200,'910','100000','67140');
If you create the table and look closely, you'll notice that by report_id and my_id more positive amounts have a direct negative amount. However, I need to identify positive amounts that do not have a negative amount corresponding my_id and report_id.
Here is what should be the expected result.
"REPORT_ID" "AMOUNT" "MY_ID" "FUND" "ORG" "1" "100" "910" "100000" "67150" "1" "200" "910" "100000" "67140"
Do not make comments on the structure of the table that it is simply an example of table I created to explain my problem, my real problem is with a lot more large table.
Thanks in advance for any help you guys can provide.
Miguel
No problem.. I corrected my logic, the logic of the ABS does not work if you have 2 lines with the same amount (I added another test scenario: report_id = 4)
CREATE TABLE TEST
(REPORT_ID VARCHAR2 (100 BYTE),
AMOUNT NUMBER (17.2).
MY_ID VARCHAR2 (30 BYTE),
FUND VARCHAR2 (20 BYTE),
VARCHAR2 (20 BYTE) ORG
)
/
Insert into TEST (REPORT_ID, AMOUNT, MY_ID, ORG) values ('1', 50, '910', ' 100000', ' 67120');
Insert into TEST (REPORT_ID, AMOUNT, MY_ID, ORG) values ('1', - 50, '910', ' 100000', ' 67130');
Insert into TEST (REPORT_ID, AMOUNT, MY_ID, ORG) values ('1', 100, '910', ' 100000', ' 67150');
Insert into TEST (REPORT_ID, AMOUNT, MY_ID, ORG) values ('2', 200, '910', ' 100000', ' 67130');
Insert into TEST (REPORT_ID, AMOUNT, MY_ID, ORG) values ('2'-200 '910', ' 100000', ' 67120');
Insert into TEST (REPORT_ID, AMOUNT, MY_ID, ORG) values ('1', 200, '910', ' 100000', ' 67140');
Insert into TEST (REPORT_ID, AMOUNT, MY_ID, ORG) values ('3', 50, '910', ' 100000', ' 67150');
Insert into TEST (REPORT_ID, AMOUNT, MY_ID, ORG) values ('3', - 50, '910', ' 100000', ' 67160');
Insert into TEST (REPORT_ID, AMOUNT, MY_ID, ORG) values ('3', 50, '910', ' 100000', ' 67170');
Insert into TEST (REPORT_ID, AMOUNT, MY_ID, ORG) values ('4' 40, '910', ' 100000', ' 67150');
Insert into TEST (REPORT_ID, AMOUNT, MY_ID, ORG) values ('4' 40, '910', ' 100000', ' 67160');
with w_base like)
Select the quantity, my_id, funds, report_id, org,
plate on (report_id partition, abs (amount)) amt_cnt,.
ROW_NUMBER() over (partition report_id, abs (amount) order of org) RID,
ABS (amount) absamt
of the test
)
Select distinct report_id, abs (amount), my_id, org, amt_cnt
of w_base
where amt_cnt! = 0
and RID = 1
order of report_id
/
REPORT_ID ABS (AMOUNT) MY_ID FUND ORG AMT_CNT
---------- ----------- ---------- -------------------- -------------------- ----------
1 100 910 100000 67150 100
1 200 910 100000 67140 200
3 50 910 100000 67150 50
4 40 910 100000 67150 80
4 selected lines.
Post edited by: Greg.Spall
Sorry, posted quick access... fixed
Tags: Database
Similar Questions
-
Find the table of characters on my computer if it is not in the accessory file
I write a scientific article for the school and could not find the table of characters on my computer. I looked in Accessories - System Tools and nothing. I should I reinstall or at least find a site online that will show you the appropriate key strokes to get what I'm looking for
Hello
Start - type in the search box-> find the table of characters at the top of list - double click it to run it.
You can also right click and COPY then PASTE an icon on the desktop or the start menu.
I hope this helps.
Rob Brown - MS MVP - Windows Desktop Experience: Bike - Mark Twain said it right.
-
Find the table number B >; = number in the table but <; then next entry b
I'm trying to understand the following: find the table number B > = number in the table but < then next entry b
Table A
5
10
21
20
Table B
8
12
16
23
40
The 5 entry in table A, I would like to return 8 b
For the 10 entry I would lke to return 12 b
21 entry I would like to return 23 b
20 entry I would like to return 23 b
Edited by: Withnoe October 5, 2012 09:19
Edited by: Withnoe October 5, 2012 10:54CREATE TABLE TAB_A (CLASS # VARCHAR2 (10), THE NUMBER OF TERM);
CREATE TABLE TAB_B (CLASS # VARCHAR2 (10), THE NUMBER OF TERM);INSERT INTO TAB_A VALUES ('BIOL 520', 201010);
INSERT INTO TAB_A VALUES ('BIOL 521', 201250);
INSERT INTO TAB_A VALUES ('BIOL 522', 200980);INSERT INTO TAB_B VALUES ('BIOL 520', 201110);
INSERT INTO TAB_B VALUES ('BIOL 520', 201150);
INSERT INTO TAB_B VALUES ('BIOL 520', 201250);
INSERT INTO TAB_B VALUES ('BIOL 521', 201250);
INSERT INTO TAB_B VALUES ('BIOL 521', 201260);SELECT MIN (TAB_B.TERM) TERM, TAB_B.CLASS # TO TAB_A, TAB_B
WHERE TAB_A.CLASS # = TAB_B.CLASS #.
AND TAB_B.TERM > TAB_A.TERM
GROUP TAB_B.CLASS #;Please let us know if you need anything else. Thank you
-
How to find the table in a schema, if I only have a particular column name
Hi all
Ideal if some1 could help me, I know not a column name and I need to find the table that actually holds this column paricular name I know.
is it possible to find this particular table with SQL?
Thank you
RahulSelect the table TABLE_NAME from user_tab_columns where column_name = 'COLUMN_NAME '.
-
How to find the table - is - this normal table or external table?
Hello
Regardless of DML operations in normal and reading tables only access tables outside, is there a way to find the specified table is regular table or the external table?
Thanks in advance.
Suresh.One possibility would be to query the ALL_EXTERNAL_TABLES data dictionary view. If there is a line in ALL_EXTERNAL_TABLES to the table, wondering (I assume you know that you query a table, a view, or a synonym), it is an external table. Otherwise, it's an ordinary table.
Justin
-
How to find the tables placed only on pages.
Hi experts,
I find all the tables in the document (no XML Indd file.) .indd There is only a certain number of tables. And a table in the master page also. Now I'm trying to get back only the tables except the master page. How can I got it?
I used the following code. But it is not working properly.
var myTables is app.activeDocument.stories.everyItem () .tables;.
App.Select(mytables[0]);
var myTableCount = myTables.length;
Alert (myTableCount);
for (var i = 0; i < myTableCount; i ++) {}
var myTableObj = myTables [i];
Alert (myTableObj.parent);
Try
{
var myTableObj.parent.parentPage.name = XXX;
If (xxx.match("^[0-9]+$"))
{
Alert ('table');
myTableObj.label = 'table' +(i+1);
}
on the other
{
Alert ("Master Page table");
}
}
catch (e)
{
Alert (e.message);
}
}
Always throw catch loop...
Can someone guide me...!
Thank you and best regards,
Vel.
Hi Peter,.
Finally, I close with the codes below. It make me fight a lot...
var pagelen = app.activeDocument.pages.length;
Alert (pagelen);
for (var i = 0; i)<>
{
var pageitemlen = app.activeDocument.pages [i].pageItems.length;
for (var j = 0; j)<>
{
v var = app.activeDocument.pages [i] .pageItems [j] .tables;
Alert (v.Length);
for (var x = 0; x)<>
{
App.Select (v [x]); Here, I can select.
App.Selection [0] .label = "table" + count;
Count ++;
myTables.push (v [i]);
}
}
}
Peter, thank you very much for your time in Golden for my problem...
With respect,
Vel.
-
Try to find the table of Directors of a group of fabric (EnterpriseAdminGroups)
Hello
I'm not having much luck finding a way to determine the list of users in the "fabric administrators' shown in VRA (VCAC) using a script in VCO. Does anyone have any idea on how I can do to get the table of users?
I was able to do with groups of companies:var groups = vCACCAFEEntitiesFinder.getBusinessGroups (vCACHost);
for {(i in groups)
System.Debug ("groups [" + i + "] =" + groups [i]);
var = Admins groups [i] .administrators;
}
I'm so looking for something similar, but related to EnterpriseAdminGroups, which does not have the property of "Administrators".
So far I only have this code, which is not having me administrators:
entities var = vCACEntityManager.readModelEntitiesByCustomFilter (vCACHost.id, "ManagementModelEntities.svc", "EnterpriseAdminGroups", null, null);
System.log ("Enterprise Admin groups found:" + entities.length);
var prop = new Properties ();
for each {(entity in entities var)
System.Debug ("\n\nentity:" + entity);
Prop.put (Entity.GetProperty ("adminname"));
}
Thank you!
OK, I think I finally thought to it. GetFabricGroupAdminByVirtualMachine (vCAC:VCACHost vCACHost, vCACCAFE:VCACHost vCACCAFEHost, vCAC:VirtualMachine virtualMachine) is created. The method returns a string value of the user name found an admin of fabric for one of the groups of fabric for the computing resource that belongs to the virtual computer.
Here is the code:
If (! vCACHost) {}
throw "Missing vCACHost (vCAC:VCACHost);
}
If (! vCACCAFEHost) {}
throw "Missing vCACCAFEHost (vCACCAFE:VCACHost);
}
If (! virtualMachine) {}
throw "Missing virtualMachine (vCAC:VirtualMachine);
}
var vchost = virtualMachine.getEntity () .getLink (vCACHost, 'Host') [0];
var fabricGroups = vchost.getLink (vCACHost, 'EnterpriseAdminGroups');
var tenantName = vCACCAFEHost.tenant;
var authorClient = vCACCAFEHost.createAuthorizationClient ();
var authorPrincipalSvc = authorClient.getAuthorizationPrincipalService ();
var currPage = 1;
numPages var = 1;
var maxItemsPerPage = 25;
loop through each page
While (currPage<= numpages)="">=>
var page = new vCACCAFEPageOdataRequest (currPage, maxItemsPerPage);
var princExtResult = authorPrincipalSvc.getPrincipalExtensions (tenantName, page);
updating with the number of pages received
numPages = princExtResult.getMetadata () .getTotalPages ();
for (var i in {princExtResult.getContent ())}
var princExt = princExtResult.getContent ([i]);
var spans = princExt.getScopes ();
for {(var j in spans)
var range = extended [j];
for (k fabricGroups) {}
{If (scope.getName () = {fabricGroups [k] .getProperty ('AdminName'))}
var scopeRoles = scope.getPrincipalScopeRole ();
for (var x in scopeRoles) {}
If (scopeRoles [x] .getName () = "Company administrator") {}
found a fabric admin
System.Debug ("found fabric group admin:" + princExt.getDisplayName ());
Return princExt.getDisplayName ();
}
}
}
}
}
}
currPage ++;
}
no users found
Returns a null value.
-
How to find the tables that are used in a procedure
Hello
I need to write a SQL to find (user_source) procedures or triggers (from user_triggers), whose code contains the registerd tables in a table X.
In other words, I have a table X with files having a column containing tables. I want to write a SQL to obtain these (proc, package and triggers) container objects or use the tables inside
Can you help me?
Thank you!Mark1970 wrote:
Hello
I need to write a SQL to find (user_source) procedures or triggers (from user_triggers), whose code contains the registerd tables in a table X.
In other words, I have a table X with files having a column containing tables. I want to write a SQL to obtain these (proc, package and triggers) container objects or use the tables inside
Can you help me?
Thank you!I don't know if I understand your problem, but have you had a glance at the data dictionary views USER_DEPENDENCIES or ALL_DEPENDENCIES?
It has classified hard dependencies of objects.
If a table is used directly (not in dynamic SQL code in a string) in an object PL/SQL, the dependency is available in the stated points of view. -
cannot find the table name of the multiple tables which has more columns.
Hello
I'm trying to find the NAME of the TABLE from multiple tables which has more columns. I can't count the number of columns in the table, but cannot find the name of the table that has larger columns in other tables.
SELECT TABLE_NAME, COUNT (*) FROM THE USER_TAB_COLUMNS WHERE TABLE_NAME LIKE '% LOC' GROUP TABLE_NAME
Thank you.in SQL, you can try this:
var v_name varchar2(40) begin with subq1 as ( select table_name, count(*) as column_count from user_tab_columns where table_name like 'FIBER%' group by table_name order by count(*) desc ) select table_name into :v_name from subq1 where rownum = 1; end;
To get the result:
select :v_name from dual
The clause "with" brings together all the tables and ordered them all first, by the greatest number of columns
The final query uses the rownum restriction so that it takes the first name from the table of results of the subquery.The restriction of rownum also exactly guarantees a result each time so that it will work with the variable binding.
RP
-
Not able to find the tables of IOM
Hi xperts.
I use OIM9101 and sql developer to access the db. I created a connection, but when I'm looking the IOM tables, I'm not able to find a... just the tables précréé
Any help...
MahiThen its fairly simple. Connect with username = oimuser and password = everything you used during installation
But if its still throw an error, then you need either by putting the wrong password. It confirms once more
Thank you
Sunny
-
Hello
I have a java Apps to connect to a database of GR 11, 2.
When I clicked on a "billing" module, I don't 'a number' 1,641.00 error in java logs that cause billing does not be generated.
I don't even enter this value. I don't know if this error at the level of the table or during analysis on the coast of java it fetch a numeric variable placeholder.
I simply assume that it is at the database level. And assuming that I am the only user in the database.
How can I get this operation with the 1,641.00 value and determine which table was is inserted to the error? In V$ SQLAREA maybe?
Thank you very muchSYSUSER - 263293-40-1 2012-07-10 11:08:25,578 [http-6700-1] INFO (support.context.CacheManager) Registering cache 'BusinessObjectInfoCache' SYSUSER - 263293-41-1 2012-07-10 11:08:25,859 [http-6700-2] ERROR (api.service.ServiceExecutionPolicy) Rollback: Read failed java.lang.NumberFormatException: Not a number: 1,641.00 at com.ibm.icu.math.BigDecimal.bad(BigDecimal.java:3894)
Kins>
apps itself has no problem.
>
I have to disagree. If the application is to throw an exception and the journal contains her not the information necessary for you tell what is causing the exception, and then the application has ALSO a problem.java.lang.NumberFormatException: Not a number: 1,641.00 at com.ibm.icu.math.BigDecimal.bad(BigDecimal.java:3894)
Add additional record to the app to catch the exception and discover the connection, the request and the record that causes the error.
Troubleshoot, to gather information when the problem actually occurs and work your way backwards.
If you say that the problem did not exist before the developer made the change then prove it by running the old code against the same data. If it works then the problem is with the change that made the developer.
-
query to find the tables of database with maximum or data entries
Hello
I'm looking for 10 tables of volume in my database
ConcerningHi user;
Please try the following query:
Diagram of how much we have and their size
define 999 pages
format of 'size Mo' 999 999 999 col
Col 'objects' format 999 999 999
Select obj.owner 'owner ',.
obj_cnt 'Objects', decode (seg_size, NULL, 0, seg_size) 'size Mo' of
(select master, the obj_cnt of count (*) group by owner dba_objects) obj;
(select master, seg_size of ceil (sum (bytes) / 1024/1024) of the group by owner dba_segments) seg where obj.owner = 1, seg.owner (+) order by 3 desc, desc 2To find ten bigest object on our database
Col owner format a15
Col nom_segment format a30
Col segment_type format a15
Col Mo format 999 999 999
Select nom_segment, segment_type, Mo, owner of)
Select nom_segment, segment_type, owner, bytes / 1024 / 1024 "MB" in dba_segments
order by bytes desc) where rownum<>Respect of
HELIOS -
Important, I can't find the table of the hierarchy for Sony - for a research paper
Hello
Student and a PS3 gamer.
I need a chart of the hierarchy for Sony - for a research paper
I thank.
Hi J D,
Welcome to the community of Sony!
Unfortunately, the information on research in education or reports can be provided online. I recommend the book "MADE IN JAPAN", written by Akio Morita (our founder) as an excellent resource for the history of Sony and our products. You can also visit the following Web site for a detailed presentation of the history of the company:
http://www.Sony.net/SonyInfo/CorporateInfo/history/SonyHistory/
You can also view our annual financial report to:
http://www.Sony.net/SonyInfo/IR/financial/ar/index.html
If my post answered your question, please mark it as "acceptable Solution".
Thank you for your message.
-
Find the table if element have the same element in all indexes
Hello
I need to check if a table have the same element in all its indexes. (Example: an array of size 4, should have index 0... 3 1 and during the next iteration index whether no. 2 overall indexes...) How can I check if all indexes have same number)
Attached to the VI I did.
Anyone can offer better than this.
get the first element, compare it with the hole dashboard, AND all items
-
Hi all
I want to change this PDF Spreadsheet XML.
The code is
ADOc AcroAVDoc = new AcroAVDoc();
RPSC AcroPDDoc = new AcroPDDoc();
String path = "";
ADOC. Open (folderPath + @"\" + Pathnew1.Split('\\') [8]. Split('.') [0] + « .pdf », « ») ;
RPSC = adoc (AcroPDDoc). GetPDDoc();
js object is pdoc. GetJSObject();
JS = Acropddoc.GetJSObject ();
Type T = js. GetType();
String vFile = pdoc. GetFileName();
total number of pages
Double nPages = ((double) T.InvokeMember)
"numPages."
BindingFlags.GetProperty |
BindingFlags.Public |
BindingFlags.Instance,
NULL, js, null);
path = Pathnew1.Split('\\') [8]. Split('.') [0] ;
Object [] saveAsParam is {path + '.xml', 'com.adobe.acrobat.spreadsheet'};.
T.InvokeMember)
"Save as."
BindingFlags.InvokeMethod |
BindingFlags.Public |
BindingFlags.Instance,
null, js, saveAsParam);
}
Is there no tables in the document then it is simply not the action just to try. Data retrieval is from guess what is a cell, row and column; the results are often uncertain and should be checked carefully. Your document must not look enough like a spreadsheet. This isn't a problem with the API.
Maybe you are looking for
-
Anyone know of any way to bypass the App Store cell limit 100 MB?
-
HP Pavilion dv6-3121: start/restart problem
Hello everyone, Yesterday I installed the Intel PROSet/wireless software from the utility to update successfully, on my laptop computer hp laptop pavilion entertainment dv6-3121. After successful installation, I restarted my computer. Since then, my
-
Hi Expertise, I have a confusion with the number of ports [A9K-MOD80-SE = and A9K-MOD160] cards. In the other Word is each map MOD needs adapter MPA or its ports are build. Example: If I get under cards, how many ports I have: A9K-MOD80-SE = MPA-A9K-
-
Request is not automatically brought in the foreground on the second launch
Hey,. I have a problem which is probably easiest explained using the ActiveTextFieldsDemo sample that comes with the SDK. Basically, if I enter in my calendar app, type a number in a text field 9-digit Active, click it, and then click the location, t
-
Pruning of database Volumes App - application functionality
According to KB VMware: the size of the Volumes VMware App SQL database the Appvolumes database needs to be cleaned regularly.Given that not all Volumes App admins are database administrators, we don't necessarily have the right to do.I was going to