Find the missing values in the third from the two other tables table

Hi - I tried to do it myself, but the answer escapes me. Can someone tell me please in a sense better? We have a project_categories with project_IDs and category_IDs related project table. We have another contact_categories with contact_IDs and related category_IDs contact table. We use these two tables to link contacts with the projects at least a stuff. It works well for e-mail notifications. We have a third table to 'pay' who are interested in specific projects. The hold table has contact_IDs and project_IDs related. I want to find contacts who have expressed interest in a project, by inserting a row in the table of the licensee, but they did not choose the project categories in the contact categories. It would be an exceptionally rare exception, so the test I added myself as 100010 contact as a 'holder' project, but deliberately do not have related project selected in the categories contact categories.

Select cc.category_id, ph.contact_id, ph.project_id, pc.category_id
of purchasing_planholder ph, purchasing_project_categories pc, purchasing_contact_categories cc
where ph.project_id = pc.project_id
and ph.contact_id = cc.contact_id
and ph.contact_id. Ph.project_id | CC.category_id
not in (select ph.contact_id |) PC.project_id | PC.category_id
of purchasing_planholder ph, purchasing_project_categories pc, purchasing_contact_categories cc
where ph.project_id = pc.project_id
and ph.contact_id = cc.contact_id)
and ph.contact_id = 100010

It gives me every category for the touch test and each category for the project. I want to find contacts in the table of holders who have not selected the categories related to the specific project they selected in the table of the licensee. I tried less, outer joins, etc. This requires it PL/SQL and a temporary table, or can I find exceptions with a report? Or do I need a different approach? The ideal response would display a line with the contact_ID and the project, where the contact has not selected project categories. This would serve to inform them that they must select at least one of the categories project on the contact form. Thanks for any comments.

Peter

CONTACT_ID PROJECT STUFF STUFF
---------------------- ---------------------- ---------------------- ----------------------
100010 701 1 19
100010 701 1 18
100010 701 16 19
100010 701 16 18
100010 701 21 19
100010 701 21 18
100010 701 24 19
100010 701 24 18
8 selected lines

Hi user,

When you post a Question in the Forum, please be clear entries must be given, the expected results and the tests you do,
the errors/results that is facing you.

Also, see this link to BluShadow.

SQL and PL/SQL FAQ

Please attach the query or programs in the code tags for code formatting.

Just try something like that,

SELECT *
  FROM emp c
 WHERE NOT EXISTS (SELECT *
                     FROM emp a
                    WHERE EXISTS (SELECT *
                                    FROM emp b
                                   WHERE a.empno = b.empno));

In the inner query, the verified conditon is same empno in the tables and for example, some lines are obtained, other than
train all results of the outer query.

In the above case, no rows are returned.

Thank you
Shankar

Tags: Database

Similar Questions

  • Is it possible to find the two sentences into one pdf file? For example, I know the words 'Here' and 'the answer' occur more than once in my document, but only once on the same page. I'm looking for this page.

    Is it possible to find the two sentences into one pdf file? For example, I know the words 'Here' and 'the answer' occur more than once in my document, but only once on the same page. I'm looking for this page.

    I tried to do this by using the search but it will find only them, if they occur as a long chain, that is to say "Here's the answer" rather than how they occur in the document it is to say "Here 's" a bunch of information that leads you to 'the answer'. The search feature so standard did not help.

    Then I tried to do this by using the tool to delete (obviously not the application of writing!) because it allows me to search for multiple words or phrases, however it is not highlight what page both are found. I tried to turn on the preference to enable deletions of comments and even if it meant that I could then go through all the comments, it's still not faster than my document is more than 1,000 pages, which meant there were too many total comments for me to be able to easily identify which page had both.

    Any ideas?

    There is no built-in way to search for two strings and limited to show only the results that appear on the same page.

    It can be done by using a custom script, however.

  • How to find the user Apex table

    Hello

    Please let me know, how to find the user apex table. I need validate the unique user based on the same, for which I use below function.

    DECLARE
    VAL A BOOLEAN;
    BEGIN
    VAL: = APEX_UTIL.IS_USERNAME_UNIQUE (p_username =
    (: P6_USERNAME);
    END;

    However, in this case, he always comes back "FALSE," saying new user exists.

    Kindly help me in fixing this problem.

    There is a view called apex_workspace_apex_users.

    Details under Home > utilities > Application Express views

    André

  • in my home network xp laptop in 'My network places' can't see the two other vista computers portable altought they can see computer laptop xp

    in my computer laptop network xp home in my network places can not see the two other vista computers portable altought they can see xp laptop computer and access this computer laptop xp shared docs, laptops 2 vista can see eachother so working group name is on all computers the same portable 3, all are connected etc. What can I do to see the portable 2 on my computer vista laptop xp

    Hi wiking17,
     
    Follow the suggestion given in the article below to resolve this issue:
     
     
    Additional reference on:
     
  • How to find the names of tables that have more than 100 columns

    Hi gurus,

    Please help me find the names of the tables that have more than 100 columns in the database.

    Below will be useful for you.

    SELECT atc.OWNER,atc.TABLE_NAME,count(*)
    FROM all_tab_columns atc
    GROUP BY  atc.OWNER,atc.TABLE_NAME
    HAVING count(atc.COLUMN_NAME) > 100
    

    Adding another point, you can use user_tab_columns, all_tab_columns, dba_tab_columns, based on your needs/access.

    Thank you
    Suri

    Published by: Suri on February 23, 2012 11:30

  • Find the time displaced table

    Hi all

    I'm in oracle 10 g 2. I have a table being stripped of some process. We have several tasks scheduled for every night.

    Is it possible to find the time of what a table is dropped, just to make a guess what regular process could be the culprit?

    Enjoy your suggessions

    Thanks in advance

    NU
    select object_name,original_name,droptime
    from recyclebin
    

    If recyclebin is enabled
    So you can be insterested to configure auditing

    Best regards

    Maxim

  • Where to find the type of table table View ALL/DBA or SYS

    Oracle 10g.

    I searched the Oracle manuals and the web with nothing will do.

    I need to know in which ALL/DBA table view or SYS I find the type (Organization) of a table.
    ITO and 'normal' tables is easy, but I need exactly to know which tables are 'EXTERNAL '!
    Maybe I'm looking in the wrong place?

    ALL_ALL_TABLES has a column "table_type", but it appears in the form of external tables of ifor NULL.

    Also, I would try to avoid questioning the "SYS" tables directly.

    You can try user_external_tables or dba_external_tables.

  • How can I find the field 'Other' in my Thunderbird contacts?

    I imported my Yahoo contacts into Thunderbird. All my keywords were in the 'Notes' field in Yahoo. After import in Thunderbird, it ended up in the field 'other '.

    When I go into the search tool, it lists all of the searchable fields. 'Other' is not included. Is it possible to search for 'other '? Or is it possible to import the contacts in a way that lands the Yahoo 'Notes' in a searchable field?

    Thank you!

    I think it's this add-on you want to https://nic-nac-project.org/~kaosmos/morecols-en.html

  • By comparing the two huge table columns

    Hello

    I want to compare two tables each of RECON_APPEND_01 table contains 375 million and RECON_VS_24082011 450 million records.
    RECON_APPEND_01 is a normal table and RECON_VS_24082011 is range partitoned table.
    The two table has a primary key on the column Serial_number. (Oracle 11g R2)

    Requirment is to obtain the records in the RECON_APPEND_01 table that are not present in RECON_VS_24082011.
    I came across a few suggestions for using operator less. Here is the query and its plan to explain
    CREATE TABLE RECON_APPEND_01
    PARALLEL 3
    NOLOGGING
    AS
    ( SELECT   SERIAL_NUMBER
    FROM   RECON_APPEND_01
    minus
    select SERIAL_NUMBER from RECON_VS_24082011
    )
    Explain the Plan:
    --------------------------------------------------------------------------------------------------------------------------
    | Id  | Operation                    | Name            | Rows  | Bytes |TempSpc| Cost (%CPU)|    TQ  |IN-OUT| PQ Distrib |
    --------------------------------------------------------------------------------------------------------------------------
    |   0 | CREATE TABLE STATEMENT       |                 |   378M|  6451M|       |  1398K (43)|        |      |            |
    |   1 |  PX COORDINATOR              |                 |       |       |       |            |        |      |            |
    |   2 |   PX SEND QC (RANDOM)        | :TQ10002        |       |       |       |            |  Q1,02 | P->S | QC (RAND)  |
    |   3 |    LOAD AS SELECT            | RECON_APPEND_03 |       |       |       |            |  Q1,02 | PCWP |            |
    |   4 |     MINUS                    |                 |       |       |       |            |  Q1,02 | PCWP |            |
    |   5 |      SORT UNIQUE             |                 |   378M|  4336M|  7255M|   775K  (4)|  Q1,02 | PCWP |            |
    |   6 |       PX RECEIVE             |                 |   378M|  4336M|       |   114K  (3)|  Q1,02 | PCWP |            |
    |   7 |        PX SEND HASH          | :TQ10000        |   378M|  4336M|       |   114K  (3)|  Q1,00 | P->P | HASH       |
    |   8 |         PX BLOCK ITERATOR    |                 |   378M|  4336M|       |   114K  (3)|  Q1,00 | PCWC |            |
    |   9 |          TABLE ACCESS FULL   | RECON_APPEND_01 |   378M|  4336M|       |   114K  (3)|  Q1,00 | PCWP |            |
    |  10 |      SORT UNIQUE             |                 |   184M|  2115M|  3539M|   538K  (3)|  Q1,02 | PCWP |            |
    |  11 |       PX RECEIVE             |                 |   184M|  2115M|       |   216K  (1)|  Q1,02 | PCWP |            |
    |  12 |        PX SEND HASH          | :TQ10001        |   184M|  2115M|       |   216K  (1)|  Q1,01 | P->P | HASH       |
    |  13 |         PX BLOCK ITERATOR    |                 |   184M|  2115M|       |   216K  (1)|  Q1,01 | PCWC |            |
    |  14 |          INDEX FAST FULL SCAN| SYS_C002617302  |   184M|  2115M|       |   216K  (1)|  Q1,01 | PCWP |            |
    --------------------------------------------------------------------------------------------------------------------------
     
    Another alternate query:
    CREATE TABLE recon_append_02
    PARALLEL 3
    NOLOGGING
    AS
    SELECT   *
    FROM   RECON_APPEND_01 a
    WHERE   NOT EXISTS (SELECT  'X'
    FROM   RECON_VS_24082011 b
    WHERE   b.SERIAL_NUMBER = a.SERIAL_NUMBER)
    Explain the Plan:
    ------------------------------------------------------------------------------------------------------------
    | Id  | Operation              | Name            | Rows  | Bytes | Cost (%CPU)|    TQ  |IN-OUT| PQ Distrib |
    ------------------------------------------------------------------------------------------------------------
    |   0 | CREATE TABLE STATEMENT |                 |   378M|    26G|   450K (10)|        |      |            |
    |   1 |  PX COORDINATOR        |                 |       |       |            |        |      |            |
    |   2 |   PX SEND QC (RANDOM)  | :TQ10000        |   378M|    26G|   153K (28)|  Q1,00 | P->S | QC (RAND)  |
    |   3 |    LOAD AS SELECT      | RECON_APPEND_02 |       |       |            |  Q1,00 | PCWP |            |
    |   4 |     NESTED LOOPS ANTI  |                 |   378M|    26G|   153K (28)|  Q1,00 | PCWP |            |
    |   5 |      PX BLOCK ITERATOR |                 |       |       |            |  Q1,00 | PCWC |            |
    |   6 |       TABLE ACCESS FULL| RECON_APPEND_01 |   378M|    22G|   116K  (5)|  Q1,00 | PCWP |            |
    |   7 |      INDEX UNIQUE SCAN | SYS_C002617302  |     1 |    12 |     0   (0)|  Q1,00 | PCWP |            |
    ------------------------------------------------------------------------------------------------------------
    Based on the plan I've run the second query, but it's taking a lot of time around 4 hours and still running.
    Please suggest.

    With respect,
    Adeline Faure

    Look carefully at the request of Tubby. Your problem in your test is with b.val = null. You can't compare anything on a null using normal operators.

    SQL> select * from target_tab;
    
           VAL
    ----------
             1
             2
             3
             4
             5
             6
             7
             8
             9
            10
    
    SQL> select * from source_tab;
    
           VAL
    ----------
             6
             7
             8
             9
            10
    
    SQL> select a.*
      2  from target_tab a, source_tab b
      3  where a.val = b.val(+) and
      4        b.val is null;
    
           VAL
    ----------
             5
             1
             4
             2
             3
    

    John

  • Find the schemas whose tables are in unallocated storage spaces

    DB version: 10.2.0.4

    In our data base, all objects in a schema (user) will be provided only in a tablespace with the same name.
    For example: for a schema as BMN_PROD, we create a tablespace named BMN_PROD.
    CREATE USER BMN_PROD IDENTIFIED by dottie DEFAULT TABLESPACE BMN_PROD TEMPORARY TABLESPACE temp ;
    
    grant connect,resource,create view to BMN_PROD;
    revoke unlimited tablespace from BMN_PROD;   
    alter user BMN_PROD quota unlimited on BMN_PROD
    Now, we noticed that the tables owned by a single user are lying on a different tablespace.
    We want to find all these patterns that has objects in storage greater than 1.
    I wrote a query using DBA_TABLES view, but it is not wearing the correct result
    SELECT owner, tablespace_name, count(*)
    FROM DBA_TABLES DT
    WHERE OWNER NOT IN ('SYS','SYSTEM')
    --AND ROWNUM < 2000
    group by owner, TABLESPACE_NAME
    order by count(*) desc
    Published by: herbaceous January 3, 2011 06:26
    Changed the password

    This should do the trick:

    Select the owner, count (distinct tablespace_name)
    from dba_tables
    Group by owner
    having count (distinct nom_tablespace) > 1

  • I can't find the two fonts I used in Photoshop "Harrington" and "Onyx".

    I reinstalled Adobe Photoshop CS5 on my new laptop, but the menu of available fonts has now changed.  I find it anymore 'Harrington' or 'Onyx' that I used for my book covers.  How can I find (and use) this new?

    It seems that these fonts are installed with microsoft office.

    You have installed on windows microsoft office 7?

    Onyx - Version 1.51

    Harrington - Version 1.51

  • Find the names of table in forms.fmb?

    Hello everyone

    I need to remove a schema tables but I didn't know if this table is used by certain forms or not.
    so I asked if he program I can give him the name of the table and the directory that contains the forms.fmb
    and this program return forms used at the table.

    There is commercial software that is able to do (like pitts or FormsAPIMaster)

  • How to find the max value of scrollV in AS3?

    I used the response from Ned to get my 3 fields of scrolling text set based on the value of one of them. Thanks Ned!

    The other two text fields scroll to match the text box 'parent', but in the end – you get to the last scroll position - the other two do not update and 3 text fields are out of alignment. It's just at the end of the roll. The rest of the scroll values line up. I think that if I can find the scrollV max value, I can force the two others to scroll one last time when this value is reached by the text field "parent".

    The textfield object has a property for this: maxScrollV.

  • Outer join to find the missing?

    I have 2 tables:

    with stud_courses as
    (
    Select studentid 111, 2, 2201 coursecategory courseid, 'A' GRADE of double
    Union
    Select studentid 111, 2, 2203 coursecategory courseid, CATEGORY "B" of the double
    Union
    Select studentid 111, 4 coursecategory, 2121 courseid, 'A' GRADE of double
    Union
    Select studentid 222, 3 coursecategory, 1111 courseid, 'A' GRADE of double
    Union
    Select studentid 222, 3 coursecategory, 1112 courseid, 'A' GRADE of double
    )
    course_categories as
    (
    Select 2 coursecategory, 2201 courseid double
    Union
    Select 2 coursecategory, 2202 courseid double
    Union
    Select 2 coursecategory, 2203 courseid double
    Union
    Select 2 coursecategory, 2204 courseid double
    Union
    Select 3, 1110 coursecategory courseid double
    Union
    Select 3 coursecategory, 1111 courseid double
    Union
    Select 3 coursecategory, 1112 courseid double
    Union
    Select 3 coursecategory, 1113 courseid double
    Union
    Select 4 coursecategory, 2120 courseid double
    Union
    Select 4 coursecategory, 2121 courseid double
    Union
    Select 4 coursecategory, 2122 courseid double
    Union
    Select 4 coursecategory, 2123 courseid double
    )

    For each student, wants to add the missing courseids for the coursecategory he takes. So student because 111 is in coursecategory 2 I should be able to show all results for him, including the ID of course 2202 and 2204 of category 2 and 2120, 2122, 2123 for this child

    My end result would be something like:

    StudentID, courseid, coursecategory, grade
    111,2,2201, "A".
    111,2,2201, '
    111,2,2203, 'B '.
    111,2,2201, '
    111,4,2120, '
    111,4,2121, "A".
    111,4,2122, '
    111,4,2123, '
    222,3,1110, '
    222,3,1111, "A".
    222,3,1112, "A".
    222,3,1113, '

    I know how to do it with a Union and not exists, but I was wondering if I could do it with an outer join.

    I would appreciate your help.

    Thank you

    Hello

    Yes, you can do it with an outer join. The tricky thing is you need outside to join the table real stud_courses to something that has valid all combinations of the studnents and prices. There is no single table that contains it; the following query will receive these combinations by making a cross join:

    WITH     all_students     AS
    (
         SELECT DISTINCT     studentid
         FROM          stud_courses
    )
    ,     got_category_cnt     AS
    (
         SELECT     all_s.studentid
         ,     c.coursecategory
         ,     c.courseid
         ,     NVL ( s.grade
                  , 'M'
                  )               AS grade
         ,     COUNT (s.grade) OVER ( PARTITION BY  all_s.studentid
                                     ,          c.coursecategory
                             )      AS category_cnt
         FROM           all_students         all_s
         CROSS JOIN      course_categories  c
         LEFT OUTER JOIN      stud_courses         s  ON    s.studentid     = all_s.studentid
                                             AND   s.courseid          = c.courseid
    )
    SELECT       studentid
    ,       coursecategory
    ,       courseid
    ,       grade
    FROM       got_category_cnt
    WHERE       category_cnt     > 0
    ORDER BY  studentid
    ,       coursecategory
    ,       courseid
    ,       grade
    ;
    

    The results I get are:

    `STUDENTID COURSECATEGORY   COURSEID G
    ---------- -------------- ---------- -
           111              2       2201 A
           111              2       2202 M
           111              2       2203 B
           111              2       2204 M
           111              4       2120 M
           111              4       2121 A
           111              4       2122 M
           111              4       2123 M
           222              3       1110 M
           222              3       1111 A
           222              3       1112 A
           222              3       1113 M
    

    These are a little different from what you have posted.

    user9207291 wrote:
    ...
    StudentID, courseid, coursecategory, grade
    111,2,2201, "A".
    111,2,2201, '
    111,2,2203, 'B '.
    111,2,2201, '
    111,4,2120, '
    111,4,2121, "A".
    111,4,2122, '
    111,4,2123, '
    222,3,1110, '
    222,3,1111, "A".
    222,3,1112, "A".
    222,3,1113, '

    Is it because there are errors in what you posted? Do you really want to have three lines of output for the same studentid (111) and courseid (2201)?

    Looks like there should be a slick way to do this with a partitioned outer join.
    A partitioned outer join matches each row of table A with the lines in table B, but, if there is no correspondence between a given A line and a line to a given partition of B, that the rank of A and the B partition is included in the game anyway. Here, we want the two partition tables.

  • Cannot find the printer Laserjet 5100 for Windows 7 driver

    I have a HP Laserjet 5100 printer installed on a computer running XP that is on a network without internet access working group.  I have a new Windows 7 computer to the same workgroup.  I want to print documents created on Windows 7 computer with the Laserjet Printer, but I need to install the printer driver Windows 7 to do this.  The drivers of HP support site says the necessary driver is built into Windows 7, but it tells me it's name or I would like to download it.  Suggestions on how to find or download the driver or what is called?

    Hi micror,.

    Drivers for Windows 7 are only available online through Windows Update...

    If the specific computer is unable to access the web, you can download the drivers from the Microsoft Update Catalog.

    As you the not mentioned your operating system type, you can find the two options below...

    If you are not sure of your type of operating system, follow the steps below:

    http://support.HP.com/us-en/document/c02033168

    For the edition of 32-bit operating system, use the first result, 64-bit for the third or the fifth option (that very of your processor type, wrong that does not...)

    http://catalog.update.Microsoft.com/v7/site/search.aspx?q=LaserJet%205100

    To download the Microsoft driver, first add the required file to the basket.

    Then click on view basket and follow the download link...

    Because the packet is compressed, you will need to use any archiver program to extract (for example Winrar).

    Last but not least, as a printer is installed on Windows XP can not be automatically shared with the new client OS you need to add drivers to manually as follows:

    1. After you download the right driver to extract it to a temporary folder.
    2. From the Client (Windows 7) go to printers and devices and click Add a printer.
    3. Select this option to add a local printer
    4. From the port selection screen you can create a new port by selecting a Local Port.
    5. In the port name fill a \\HOSTNAME\Sharename prefix
      • To locate the host name of your HOST computer (XP PC), made a right click my computer and select Properties, the hostname will be listed on this screen...
      • To locate the name of the share go to printers and faxes, click right-click the printer icon and select Properties... Then, go to the sharing tab and appears the share name.
    6. Continue add it an assistant of the printer and the driver selection, click on disk... Browse ocntaining pilots the INF folder from your printer.

    Good luck

    Shlomi

Maybe you are looking for

  • Messages &amp; problem of FaceTime on El Capitan

    Nice day. Just bought the new MBPro 13 "and tried to compensate for OS X 10.11.4 using my Apple ID, which is used on iMac, old MBPro iPhone and iPad. init and iCloud connection smooth, but I could not get into the Messages and FaceTime using the Appl

  • Could NOT IMPORT the panasonic DVX200. MOV 59, 94pp

    Hello pls the last X 10.2.2 FCP import files from my Panasonic (.mov 100 M FHD 59, 94pp), but at the end I saw nothing and matter once the file is completely black (audio only), the photos are like in the picture here. In an old version (10.1.3) Yose

  • HP Pavilion 15ab253cl: Photoshop button shortcut

    Photoshop shortcut key combination Ctrl + Shilft + Alt + L (auto contrast) opens the diagnosis 'touch screen '.Very annoying.Right click on the taskbar icon tasks does not offer the possibility to "close all windows".

  • NEW USER of Windows8

    I am an older Lady (72) with a new laptop that has windows 8.   I'm in love with the touch screen, but totally dislike having to connect whenever I decide to use my computer.   Is it possible to disable this at the beginning of each session? Thank yo

  • HPPavilion slimline s7600n with processor AMD Athlon 64 3500 considered 32 or 64 bit for windows 7 upgrade

    What version of windows upgrade 7 should I use to upgrade Windows XP SP 3 for Hp Pavilion Slimline s7600n with AMD Athlon 64 Processor 3500 +.