Get rowns that don't exist in any of the tables.
Hi,
I need to implement some views to compare systems.
This views will compare tables with the same structure and I want to extract the rows that don’t exist in any of the sides.
I need to implement some views to compare only two tables, others to compare 3 tables and one to compare 5 tables and another to compare 10 tables!
Each table can contains from a few rows up to 10 million rows (that was the biggest count I found for this tables).
My test scenario:
CREATE TABLE TEST_TABLE
(COL1 NUMBER ,
COL2 CHAR(25));
CREATE TABLE TEST_TABLE2
(COL1 NUMBER ,
COL2 CHAR(25));
CREATE TABLE TEST_TABLE3
(COL1 NUMBER ,
COL2 CHAR(25));
insert into TEST_TABLE (COL1,COL2) values (1,'2');
insert into TEST_TABLE (COL1,COL2) values (11,'t1');
insert into TEST_TABLE2 (COL1,COL2) values (1,'2');
insert into TEST_TABLE2 (COL1,COL2) values (22,'t2');
insert into TEST_TABLE3 (COL1,COL2) values (1,'2');
insert into TEST_TABLE3 (COL1,COL2) values (33,'t3');To find the differences between two tables I implemented the following:
select * from
(select * from TEST_TABLE
minus
select * from TEST_TABLE2
union all
(select * from TEST_TABLE2
minus
select * from TEST_TABLE
Result:
COL1 COL2
11 t1
22 t2 For the 3 tables comparison The result should be:
Result:
COL1 COL2
11 t1
22 t2
33 t3 For the other ones I can implement the same way, but for sure this is not the prettiest and most performing solution!
How can I achieve the result I intent with the most performance?
Thanks,
Ricardo Tomás
You didn't say if you allow duplicates in your tables, so i assumed you didn't.
If a single table could have multiple occurrences of a given col1, col2 combination you would need to distinct the col1,col2 list from each table before doing the union all.
ME_XE? select
2 col1, col2
3 from
4 (
5 select col1, col2 from test_table
6 union all
7 select col1, col2 from test_table2
8 union all
9 select col1, col2 from test_table3
10 )
11 group by
12 col1, col2
13 having count(*) = 1;
COL1 COL2
33 t3
22 t2
11 t1
3 rows selected.
Elapsed: 00:00:00.01
ME_XE?
Similar Messages
-
i am trying to install itunes on my computer which is running windows 7, sp1, 64 bit. i get the message 'THIS INSTALLATION PACKAGE COULD NOT BE OPENED.VERIFY THAT THIS PACKAGE EXISTS, ETC'. any ideas how to fix?
thanks jakeHello tcampbell1549,
Thank you for using Apple Support Communities.
For more information, take a look at:
Issues installing iTunes or QuickTime for Windows
http://support.apple.com/kb/ht1926
Have a nice day,
Mario -
How do I show a count for rows that don't exist?
Hi, I'm trying to count the number of records grouped by rank(B,C,R),month,and year. Basically, anytime a part fails testing a record is entered which records the failure Rank and occurrence date. A record is only inserted if a part failed for specific rank. So not all 3 ranks will have entries. I'm able to count all ranks by month,year that do exist. But how do I get values of 0 for the ranks that don't exist? I just created a table qa_rank that has just one column rank with 3 records(b,c,r). but its not being used as of now. rank is just a column in qa_occ record.Here is my query.
select to_char(occdate,'YY') as yr, to_char(occdate,'MM') as mn,
rank, count(occdate)
from qa_occ
where q.occdate between '1-Apr-2005'and '31-Mar-2006'
and q.supplier = '11107'
group by to_char(q.occdate,'YY'),to_char(q.occdate,'MM'),q.rank
order by to_char(q.occdate,'YY'),to_char(q.occdate,'MM')
which returns this
YY MM RANK COUNT(OCCDATE)
05 09 C 2
05 10 C 2
05 11 C 1
05 11 R 1
06 01 C 3
06 02 C 1
06 03 B 1
06 03 C 2
I need it to return C,B,R for everymonth. If no records exist then the count for the month,rank should be 0. Any ideas? Thanks.something like:
SQL> with qa_occ as
2 (select to_date('09/15/2005','mm/dd/yyyy') occdate, 'B3661-RYPX-A000' part, 'C' rank, 4 indexpoints from dual
3 union all
4 select to_date('09/25/2005','mm/dd/yyyy') occdate, 'B3661-RYP-A000' part, 'C' rank, 4 indexpoints from dual
5 union all
6 select to_date('10/11/2005','mm/dd/yyyy') occdate, null part, 'C' rank, 7 indexpoints from dual
7 union all
8 select to_date('10/20/2005','mm/dd/yyyy') occdate, 'B3661-RYP-A000' part, 'C' rank, 4 indexpoints from dual
9 union all
10 select to_date('11/11/2005','mm/dd/yyyy') occdate, null part, 'C' rank, 4 indexpoints from dual
11 union all
12 select to_date('11/18/2005','mm/dd/yyyy') occdate, 'B3661-RYPX-A000' part, 'R' rank, 0 indexpoints from dual
13 union all
14 select to_date('01/11/2006','mm/dd/yyyy') occdate, 'B3661-RYP-A000' part, 'C' rank, 4 indexpoints from dual
15 union all
16 select to_date('01/25/2006','mm/dd/yyyy') occdate, '3511-RNA0-0111' part, 'C' rank, 4 indexpoints from dual
17 union all
18 select to_date('01/27/2006','mm/dd/yyyy') occdate, '3511-RNA0-0111' part, 'C' rank, 4 indexpoints from dual
19 union all
20 select to_date('02/15/2006','mm/dd/yyyy') occdate, '3511-RNA0-0111' part, 'C' rank, 4 indexpoints from dual
21 union all
22 select to_date('03/07/2006','mm/dd/yyyy') occdate, 'B3661-RYP-A000' part, 'C' rank, 4 indexpoints from dual
23 union all
24 select to_date('03/14/2006','mm/dd/yyyy') occdate, 'B3661-RYP-A000' part, 'C' rank, 4 indexpoints from dual
25 union all
26 select to_date('03/15/2006','mm/dd/yyyy') occdate, '3511-RNA0-0111' part, 'B' rank, 13 indexpoints from dual)
27 select * from qa_occ;
OCCDATE PART R INDEXPOINTS
15-SEP-05 B3661-RYPX-A000 C 4
25-SEP-05 B3661-RYP-A000 C 4
11-OCT-05 C 7
20-OCT-05 B3661-RYP-A000 C 4
11-NOV-05 C 4
18-NOV-05 B3661-RYPX-A000 R 0
11-JAN-06 B3661-RYP-A000 C 4
25-JAN-06 3511-RNA0-0111 C 4
27-JAN-06 3511-RNA0-0111 C 4
15-FEB-06 3511-RNA0-0111 C 4
07-MAR-06 B3661-RYP-A000 C 4
14-MAR-06 B3661-RYP-A000 C 4
15-MAR-06 3511-RNA0-0111 B 13
13 rows selected.
assuming that there are only three ranks available B, C,and R we considered this as a lookup values. now in the query below we incorporate an inline view for the lookup values:
SQL> with qa_occ as
2 (select to_date('09/15/2005','mm/dd/yyyy') occdate, 'B3661-RYPX-A000' part, 'C' rank, 4 indexpoints from dual
3 union all
4 select to_date('09/25/2005','mm/dd/yyyy') occdate, 'B3661-RYP-A000' part, 'C' rank, 4 indexpoints from dual
5 union all
6 select to_date('10/11/2005','mm/dd/yyyy') occdate, null part, 'C' rank, 7 indexpoints from dual
7 union all
8 select to_date('10/20/2005','mm/dd/yyyy') occdate, 'B3661-RYP-A000' part, 'C' rank, 4 indexpoints from dual
9 union all
10 select to_date('11/11/2005','mm/dd/yyyy') occdate, null part, 'C' rank, 4 indexpoints from dual
11 union all
12 select to_date('11/18/2005','mm/dd/yyyy') occdate, 'B3661-RYPX-A000' part, 'R' rank, 0 indexpoints from dual
13 union all
14 select to_date('01/11/2006','mm/dd/yyyy') occdate, 'B3661-RYP-A000' part, 'C' rank, 4 indexpoints from dual
15 union all
16 select to_date('01/25/2006','mm/dd/yyyy') occdate, '3511-RNA0-0111' part, 'C' rank, 4 indexpoints from dual
17 union all
18 select to_date('01/27/2006','mm/dd/yyyy') occdate, '3511-RNA0-0111' part, 'C' rank, 4 indexpoints from dual
19 union all
20 select to_date('02/15/2006','mm/dd/yyyy') occdate, '3511-RNA0-0111' part, 'C' rank, 4 indexpoints from dual
21 union all
22 select to_date('03/07/2006','mm/dd/yyyy') occdate, 'B3661-RYP-A000' part, 'C' rank, 4 indexpoints from dual
23 union all
24 select to_date('03/14/2006','mm/dd/yyyy') occdate, 'B3661-RYP-A000' part, 'C' rank, 4 indexpoints from dual
25 union all
26 select to_date('03/15/2006','mm/dd/yyyy') occdate, '3511-RNA0-0111' part, 'B' rank, 13 indexpoints from dual)
27 select qa.yr, qa.mn,
28 decode(qa.rank,lk.rank,qa.rank,lk.rank) rank,
29 sum(decode(qa.rank,lk.rank,qa.cnt,0)) cnt
30 from (select to_char(qo.occdate,'YY') as yr,
31 to_char(qo.occdate,'MM') as mn,
32 qo.rank,
33 count(qo.occdate) cnt
34 from qa_occ qo
35 group by to_char(qo.occdate,'YY'),
36 to_char(qo.occdate,'MM'),
37 qo.rank) qa,
38 (select 'B' rank from dual
39 union all
40 select 'C' rank from dual
41 union all
42 select 'R' rank from dual) lk
43 group by qa.yr, qa.mn, decode(qa.rank,lk.rank,qa.rank,lk.rank)
44 order by qa.yr, qa.mn, decode(qa.rank,lk.rank,qa.rank,lk.rank);
YR MN R CNT
05 09 B 0
05 09 C 2
05 09 R 0
05 10 B 0
05 10 C 2
05 10 R 0
05 11 B 0
05 11 C 1
05 11 R 1
06 01 B 0
06 01 C 3
06 01 R 0
06 02 B 0
06 02 C 1
06 02 R 0
06 03 B 1
06 03 C 2
06 03 R 0
18 rows selected.
SQL> -
front row looks in the movies folder and lists the contents, right?
well it's showing titles in that are not in and have never been
in my movies folder.
nothing happens when selecting these (probably because they don't exist).
of course i can't delete since they do not appear in the finder or
spotlight search.
i tried deleting everything in the movies folder, of course all
that's left in front row are the movies that don't exist.
any suggestions?
Message was edited by: avinbcAre your movies, even though they're gone from the hard drive, listed in iTunes somewhere? That would make them appear in Front Row even under the Videos section.
The Front Row preference file does not remember anything except which module was the last one you used.
-Doug -
System keeps looking for a 'server' that does not exist. Is says the old name of my Airport Extreme. Clicking it away (4x) finally gets through.
Other weirdness to report: my neighbor upstairs appears to have a Linksys router network on channel 6. My AEBS is on channel 1 so there shouldn't be interference... but according to iStumbler sometimes the signal leaps to 64000 (keep in mind my own Airport never tops 60)! Is that potentially the problem?
Might it be possible that your neighbor just acquired a 802.11n (pre-N) wireless router recently?
802.11n effectively increases capacity by doubling the number of Wi-Fi radios and increasing the number of antennas used to push signals out of those radios. 802.11n splits a data frame into multiple pieces. It then transmits these pieces in parallel using multiple radios that are attached to multiple antennas. These antennas blast out signals from virtually the same vantage point – scattering the signals everywhere.
You may find the following ZDNet article interesting: http://blogs.zdnet.com/Ou/?p=247
Even if he did not, and you are on good terms, you might want to ask if he can temporarily turn off his wireless, or, at least, reduce the signal strength to see if that will help in your situation. -
How to stop iphoto from recovering photos that don't exist?
I just bought my iMac and transferred all my photos from my backup drive to the iphoto library. In organizing my photos I must have deleted photos or had some corrupted photos in the transfer. Now, every time I open iphoto is says it has recovered 75 or so photos, creates a folder for them, but it's empty. How do I stop it from trying to recovery photos that don't exist? I've searched and have found nothing. The folder generated by iphoto as a recovered folder is empty...
Welcome to the Apple Discussions.
Can you give me an idea of why this type of error occurred
Because of a minor glitch when iPhoto failed to clean up after an import.
why has this now corrected the error?
iPhoto should remove that Importing Folder at the end of the importing session. When you launched iPhoto again it saw the folder and (incorrectly) assumed there was an import in progress. Removing the folder means that iPhoto won't make that assumption.
There is no reason to assume that the problem wil recur.
Regards
TD -
Deauthorizing computers that don't exist
How am I supposed to deauthorize computers that don't exist? Every time I've had to reinstall Windows, iTunes eats up another "authorization". Now all 5 authorizations are taken, and my iTunes purchases are useless. I only have 1 computer, Apple, so make this easier for Windows users, will you?
Every time I've had to reinstall Windows, iTunes eats up another "authorization".
Your supposed to deathorize BEFORE a re-install. Not after. iTunes makes it very easy to do that.
Now all 5 authorizations are taken, and my iTunes purchases are useless. I only have 1 computer, Apple, so make this easier for Windows users, will you?
Apple makes it easy enough to de-authorize your computer. You can even do a de-authorize all once a year. Log on your account and you should be able to not only view your authorizations, but have an option to de-authorize all of them. -
How to show show the songs in my library that don't belong in any playlist?
I'm sure there's a way to do this and I'm just not thinking hard enough. Does anyone know how I can show the songs in my library that don't belong in any playlists?
Powerbook 15" Mac OS X (10.4.8)jaypogi,
Welcome to Discussions.
Use one of these scripts:
Not In Any Playlist creates a text file listing of those songs.
Not In Any Playlist To Playlist puts them in a playlist.
Hope this helps.
M
17' iMac 800 MHz, 768 MB RAM, 200 GB HD, DL burner Mac OS X (10.4.8) iTunes 7.0.2 -
I set up my iPhone through iCloud but assigned the wrong cell number to it so I am getting messages that don't belong to me but rather to my husband as I entered his cell number in there - how do I change that number to stop this from happening??
Also, if you are sharing an Apple ID, you will get his iMessages.
-
Find contacts that don't belong to any group
I'm trying to organize my contacts and I'm wondering if there is a way to list contacts that don't belong to any group in the Address Book
I figured it out.
Click on File > Add a new smart group > cards > is not a member of > any group -
iMac Running OSX 10.6.8: hard drive replaced: old PSE3 (don't like/want any of the more modern versions) reloaded fine until serial number entered, then told it couldn't activate or some such, I think because it was a single computer sale and now the new hard drive registers as a new/second computer. The program will run just fine on this computer if adobe will let me install it and activate it. Can this be done, or must I just go buy an old one on eBay, and if so will that also fail to activate? (Some one here last night wanted me to get on Skype for help, as if an old crustacean like me has Skype. No, it'll have to be done right here in print.) Can anyone help?
Unfortunately, you're in the wrong forum. This is not the Elements forum.
Here's the link to the forum you want:
https://forums.adobe.com/community/photoshop_elements/content -
I am experiencing this error with one of our cluster environment. Can anyone help me in this issue.
The Cluster Service function call 'ClusterResourceControl' failed with error code '1008(An attempt was made to reference a token that does not exist.)' while verifying the file path. Verify that your failover cluster is configured properly.
Thanks,
Venu S.
Venugopal S ----------------------------------------------------------- Please click the Mark as Answer button if a post solves your problem!Hi Venu S,
Based on my research, you might encounter a known issue, please try the hotfix in this KB:
http://support.microsoft.com/kb/928385
Meanwhile since there is less information about this issue, before further investigation, please provide us the following information:
The version of Windows Server you are using
The result of SELECT @@VERSION
The scenario when you get this error
If anything is unclear, please let me know.
Regards,
Tom Li -
The contained field name "ADTAGR" does not exist in any of the database tab
hı all
how can l solved thıs problem
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_DYNAMIC_OSQL_SEMANTICS', was
not caught in
procedure "PUT_QMFECAT" "(FORM)", nor was it propagated by a RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
An Open SQL clause was specified dynamically. The contained field name
"ADTAGR" does not exist in any of the database tables from the FROM clause.
Information on where terminated
Termination occurred in the ABAP program "SAPDBZQNQ" - in "PUT_QMFECAT".
The main program was "ZQMR_BILDIRIM ".
In the source code you have the termination point in line 732
of the (Include) program "SAPDBZQNQ".
Error occurred during batch input processing
The termination is caused because exception "CX_SY_DYNAMIC_OSQL_SEMANTICS"
occurred in
procedure "PUT_QMFECAT" "(FORM)", but it was neither handled locally nor
declared
in the RAISING clause of its signature.
The procedure is in program "SAPDBZQNQ "; its source code begins in line
715 of the (Include program "SAPDBZQNQ ".
FORM put_qmfecat.
DATA: l_tab_fields TYPE rsfs_tab_fields.
DATA: l_ds_clauses TYPE rsds_where.
Dynamische Feldselektion
MOVE 'QMFECAT_C' TO l_tab_fields-tablename.
READ TABLE select_fields WITH KEY l_tab_fields-tablename
INTO l_tab_fields.
IF sy-subrc <> c_rc00.
CLEAR l_tab_fields.
ENDIF.
Dynamische Selektionskriterien
MOVE 'QMFECAT' TO l_ds_clauses-tablename.
READ TABLE dyn_sel-clauses WITH KEY l_ds_clauses-tablename
INTO l_ds_clauses.
DB-Zugriff
>>>>> SELECT (l_tab_fields-fields) FROM qmfe
INTO CORRESPONDING FIELDS OF TABLE qmfecat_tab
WHERE qmnum = rqmqmel-qmnum
AND kzloesch = space
AND (l_ds_clauses-where_tab)
ORDER BY PRIMARY KEY.
regard sinan
Edited by: eyup_sinan on Jan 6, 2012 3:21 PM
Edited by: eyup_sinan on Jan 6, 2012 3:30 PMYou seem to have made a copy of the standard program. You'll have to make sure that you are handling this field correctly in your code.
Rob -
attempting to re-dnld purchased music to computer from itunes Store. Getting msg that store is not dnld'g at the present time..Do I need ICloud? Perhaps Store not "open" these hours? ????
You don't need iCloud to re download music.
Patricia... follow the instructions here > Downloading past purchases from the App Store, iBookstore, and iTunes Store -
I have songs in my iTunes that were purchased under an old ID (an email that no longer exists). I forgot the password so when I try to retrieve it, it is sent to the old email which no longer exists, so I can't retrieve it so I can't play/transfer those songs...what can I do?
You need to ask Apple to reset your security questions. To do this, click here and pick a method; if that page doesn't list one for your country or you're unable to call, fill out and submit this form.
(122986)
Maybe you are looking for
-
Hi I rebuilt my win xp computer did a new install of the OS. I then re- installed Photoshop CS2. For a week Photoshop and bridge worked fine then on Friday I tried to open Bridge and nothing happened. Task Manager shows bridge in the Processes and us
-
Facing Problem in Client Proxy
Hi All, I am trying to move the material data into a file using proxies. i have activated proxies and written a program in abap when i execute the abap report and when i look it in sxmb_moni i am getting the follwoing error : <?xml version="1.0" enc
-
Illustrator can't find new font
I am trying to use a new font I just downloaded online. When I try to use the font it doesn't show up in the selection. I looked and the font is located in my user > me > library > fonts folder but still won't find it. I even tried to put it in Macin
-
Nokia 6151 time and date problem
Recently I have reset my phone to Factory Setting, due to some problem that I'm having with my phone. Now, after resetting my phone to the factory setting, each time I off my phone (without removing the battery) and on it after that, I will have to u
-
Diagnostics Test: No Groups have been registered for the Advance Test
Hi recently I had refershed my Devlopement from production. When i used to launch the diagnostics tools. No goups were found for all modules. It worked before. No groups were found and messege given below was appeared. <strong>No Groups have been reg