Brain Bender - select where not data

Hi Gurus'
I have an problem that is doing my head in, just cant get the data set back that I want.
I have two tables (more than that really, these are the last two of 6 related tables) 'mitigation' and mitigation_tracking" which have a one to many relation ship.
The primary and foreign keys relationships are shown at the bottom of the post.
In my example the mitigation table (pkey MIT_ID) has 8 records and I want to return the 8 records except if the user (mit_userid) has already submitted an entry into the tracking table.
With a right outer join using MIT_ID mitigaiton to mitigation_tracking will return the 8 records and 3 nulls I want but if I try and limit this because the user has already processed some entries, is where I run into trouble.
MIT_ID     RECORD_ID     ASSET_ID CATEGORY_ID RE_ID MIT_ID MIT_USERID
10100     10046     10060     10102     10063     10100 BRAD
10071     10046     10060     10102     10063     10071     BRAD
10100     10046     10060     10102     10063     10100     SCOTT
10070     10046     10060     10104     10065     10070     SCOTT
10081     10046     10080     10140     10080     10081     SCOTT
10082     10046     10080     10140     10080          
10083     10046     10080     10140     10080          
10120     10046     10060     10102     10064          
When I try: where (mit_userid is null or MIT_USRE_ID != BRAD)
the return will still include the data with the MIT_ID = 10100 because both BRAD and SCOTT have both processed this record.
What I want in to return only the rows where BRAD has not made an entry into the second mitigation tracking table even if SCOTT has.
I thought it would be easy but no matter how I look at it I cant get a query to work.
Any help would be greatly appreciated.
Data key sets.
MITIGATION
MIT_ID     RE_ID     CATEGORY_ID     ASSET_ID     RECORD_ID DATA
10081     10080     10140     10080     10046 Some Data
10082     10080     10140     10080     10046 Some Data
10120     10064     10102     10060     10046 Some Data
10070     10065     10104     10060     10046 Some Data
10071     10063     10102     10060     10046 Some Data
10100     10063     10102     10060     10046 Some Data
10083     10080     10140     10080     10046 Some Data
MITIGATION_TRACKING
MTRACK_ID RECORD_ID ASSET_ID CATEGORY_ID RE_ID MIT_ID MIT_USERID
71 10046 10060 10102 10063 10100 BRAD
70 10046 10060 10102 10063 10071 BRAD
67 10046 10060 10102 10063 10100 SCOTT
68 10046 10060 10104 10065 10070 SCOTT
69 10046 10080 10140 10080 10081 SCOTT

I would just like to express my thanks to
The Flying Spontinalli and John Spencer.
Your suggestion have proved to be on the money.
This was one of the last things I needed to do in an APEX application that I was working on and I had been banging my head against the wall for 2 days.
I new that I needed to intersect on the mit_id but did not know about the "NOT IN" and NOT EXISTS"
I appreciate your taking the time to read, understand and respond.
Thanks
Regards
Brad

Similar Messages

  • Drop down selection is not refreshing the page data correctly

    I have a drop down menu for a CREATE DATE. The record is based on a Identification ID. This identification ID can be in our system for multiple CREATE DATES. The CREATE DATE drop down is populated by checking how many different CREATE DATES there are for a particular identification ID.
    The last identification ID looks great. It populates all the fields. However if you select an older CREATE DATE, the page does not get populated with that CREATE DATES data. The whole page even looks different. It looks like an older version of the page before I added all the new fields.
    What is causing the older CREATE DATES not to look like the current create date.
    Please let me know if you need any additional information. Thank you!!
    Pattibz

    Thank you for your reply. Here are some details. Please let me know if I am not giving the information you need.
    One page item called CREATE_DATE displayed as a Select LIST with submit. The source type is a database column called ID_IDENT. The ID_IDENT is just a
    The List of Values is: Named LOV is the Select Named LOV. The list of values definition is a query against a table in our database:
    select CRE_DT, ID_IDENT from IDENT_TABLE where UNIQ_ID = :P3_UNIQ_ID
    ORDER BY CRE_DT DESC
    This is the date on which the ID_IDENT data was created. The date is displayed in a pull down menu, which allows you to select from a list of available "as of" dates when viewing the data. Only data on the most recent ID_IDENT record may be manually altered.
    I have a UNIQ_ID = '34587443'. It acutally has records in the database with that UNIQ_ID. The only difference is the create date. On record of 345778 was done on 10/1/2008 and the current date 10/13/2008.
    I see these two dates in the CREATE_DATE pull down menu. This is fine. The drop down orders the dates by DESC so I have the lastest date on top fo the pull down.
    If I want to pick the date of 10/1/2008, I need go into the web page, open the Create Date pull down and select the older date.
    When I pick the older date 10/1/2008, the page does not look the same as the defaul tor oldest time date and numbers.
    The page is different and most of the data on the webpage is there.
    What should have happened is that I choice the newer date from the drop down, the page refreshes with the data from 10/1/2008
    and all the parameters are displayed from the date of 10/1/2008. It isn't only part of the fields are being populated and the page itself doesn't refresh to the look of the original page. Thank you.
    Edited by: pattibz on Sep 12, 2008 11:15 AM

  • 1099 Misc- RFIDYWWT program not selecting by clearing date

    Hello,
    I am trying to run the transaction S_P00_07000134 - Generic Withholding Tax Reporting for 1099 Misc forms in ECC6.0.  It is not pulling the vendor line items by the clearing date like the old 4.6 1099 program did (RFW1099M).  For example, an item was posted in 2007 and paid in 2008.  This is not getting picked up in the RFIDYWWT program.  Am I missing something?  I've selected Document clearing date under the output control and lists, but I don't think that's the right spot for data selection.
    Any help would be appreciated!
    -Lori

    Thanks Carol!  That is exactly it.  I did resort to putting in an OSS message - and that's what they told me after she "yelled" at me for asking the question...it wasn't a software issue, but remote consulting.  I'd like to see where in the SAP help it tells you that if you're not familiar with the program!
    Thanks again,
    -Lori

  • SQD3 select options not fetching all the data?

    Hi abapers,
    standard SDQ3 tcode is not fetching all the data?
    In this standard t.code how to find that for different Select-options, different data retrieval queries have been written?
    where to find the select options conditions are written?
    thans in advance

    This could be an issue as ROWTERMINATOR and FIELDTERMINATOR are not well placed.
    Use FORMAT FILE while using BULK INSERT.

  • Selecting records from table A where A.date = max of date from table B

    Hi,
    I am new to OBIEE, How can I build the following Oracle query in OBIEE....
    select a.F1, a.F2, a.F3, a.date
    from Table1 a
    where a.date in
    (select max(b.date) from Table2 b where
    b.F1 = a.F1
    GROUP BY by b.F1)
    I tried Rank, Top, Aggregate however did not get the desired result.
    Thanks, Rohit

    You can create another request and use the results of that request as a Subquery in the filtering of the master request.

  • HOW TO SELECT ONLY THOSE RECORDS WHERE NOT AVAILABLE ON SECOND TABLE

    hi
    i have two tables one name is menus and second name is UGroupDetail. Actually i have created it for user role privileges for my application
    USE [LedgerDB]
    GO
    /****** Object: Table [dbo].[Menus] Script Date: 03/28/2015 13:45:27 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[Menus](
    [RightID] [int] NOT NULL,
    [RightName] [nvarchar](200) NULL,
    [GroupID] [int] NULL,
    CONSTRAINT [PK_Menus] PRIMARY KEY CLUSTERED
    [RightID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    second table is
    USE [LedgerDB]
    GO
    /****** Object: Table [dbo].[UGroupDetail] Script Date: 03/28/2015 13:46:12 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[UGroupDetail](
    [RightID] [int] NOT NULL,
    [RightName] [nvarchar](200) NULL,
    [GroupID] [int] NULL
    ) ON [PRIMARY]
    GO
    ALTER TABLE [dbo].[UGroupDetail] WITH CHECK ADD CONSTRAINT [FK_UGroupDetail_Menus] FOREIGN KEY([RightID])
    REFERENCES [dbo].[Menus] ([RightID])
    ON UPDATE CASCADE
    ON DELETE CASCADE
    GO
    ALTER TABLE [dbo].[UGroupDetail] CHECK CONSTRAINT [FK_UGroupDetail_Menus]
    GO
    ALTER TABLE [dbo].[UGroupDetail] WITH CHECK ADD CONSTRAINT [FK_UGroupDetail_UserGroup] FOREIGN KEY([GroupID])
    REFERENCES [dbo].[UserGroup] ([GroupID])
    ON UPDATE CASCADE
    ON DELETE CASCADE
    GO
    ALTER TABLE [dbo].[UGroupDetail] CHECK CONSTRAINT [FK_UGroupDetail_UserGroup]
    UGroupDetail have many groups as assigned to a new user but Menus table has only default groups which is 90 records
    Menus table is a primary table and UGroupDetail is a Foreign key table
    now i want to combined these tables and want to get only remaining records for each group
    for example i have assigned 5 roles to GroupID 2 and now when i apply select commands the result should be 85 out 90 for GroupID 2
    but i have not idea how to modify select query for get desired result

    I don't really understand the tables. What is GroupID doing in the Menues table? And what does an entry without a RightName mean? Shouldn't that column be NOT NULL?
    The UGroupDetail does not have any primary key. From your description, I would expect the PK to be (RightID, GroupID). But strangely enough, GroupID is nullable. So is RightName, but I think this column is redundant and should be removed.
    Anyway, if I understand your question correctly, you need something like:
    SELECT UG.Name, M.RightName
    FROM   UserGroups UG
    CROSS  JOIN Menus M
    WHERE  NOT EXISTS (SELECT *
                       FROM   UGroupDetail UGD
                       WHERE  UG.GroupID = UGD.GroupID
                         AND  UG.RightID = M.RightID)
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Select where date current_date

    Hi, all
    I just tried to play with that select where I need to pick up records with TRADEDATE < 'CURRENT-DATE' and really impressed how intuituve Oracle is.
    tradedate date;
    SELECT * FROM TRADEMIX WHERE TRADEDATE <= (SELECT CURRENT_DATE FROM DUAL); works just fine, I see that even Month displayed as char 'SEP' treated in right collating order. Wow !!!
    So looks I don't need to do anything special ? It's my first experience with Oracle, so I just want to confirm that it's really the case.
    Also what will be the best way to do select only for TRADEDATE = ' 2010' (all records for give year)? Do I need to do any to_char for that? Not sure about correct syntax, all sample in texbook noted the whole date string 'DD-MON-YY'.
    Thanks
    Trent

    trento wrote:
    Hi, all
    I just tried to play with that select where I need to pick up records with TRADEDATE < 'CURRENT-DATE' and really impressed how intuituve Oracle is.
    tradedate date;
    SELECT * FROM TRADEMIX WHERE TRADEDATE <= (SELECT CURRENT_DATE FROM DUAL); works just fine, I see that even Month displayed as char 'SEP' treated in right collating order. Wow !!!
    So looks I don't need to do anything special ? It's my first experience with Oracle, so I just want to confirm that it's really the case.
    Also what will be the best way to do select only for TRADEDATE = ' 2010' (all records for give year)? Do I need to do any to_char for that? Not sure about correct syntax, all sample in texbook noted the whole date string 'DD-MON-YY'.
    Thanks
    TrentYou have some other examples for dealing with a just the year component of dates, but let me also point out a simpler form of what you have here:
    select * from trademix where tradedate <= sysdate;Just reference SYSDATE. No need to do a subselect against dual.
    And keep these things in mind:
    Oracle always stores DATE data in its internal format. That format includes both date and time.
    NSL_DATE_FORMAT, and the TO_DATE and TO_CHAR functions only deal with the presentation of the date.
    Play with this:
    alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
    select sysdate from dual;
    alter session set nls_date_format='dd-mon-yyyy hh24:mi:ss';
    select sysdate from dual;
    alter session set nls_date_format='yyyy-Mon-dd hh24:mi:ss';
    select sysdate from dual;
    alter session set nls_date_format='yyyy-MON-dd hh24:mi:ss';
    select sysdate from dual;
    alter session set nls_date_format='mm-dd-yyyy';
    select sysdate from dual;
    select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
    select to_char(sysdate,'dd-mon-yyyy hh24:mi:ss') from dual;
    select to_char(sysdate,'yyyy-Mon-dd hh24:mi:ss') from dual;Also keep firmly in mind that a character string is just that - a character string. No matter how much it may look like a date to you. Your keyboard is only capable of generating character strings. Your monitor is only capable of displaying character strings.

  • ADF 11g can not select and copy data from cell of readonly table in IE

    hi,
    In ADF 11g, when render view object as readonly table with Single RowsSelection, using IE browser can not select and copy data from the cell, but it work in firefox.
    is it a bug?
    Edited by: kent2066 on 2009-5-18 上午8:46

    Hi Timo,
    Sorry forgot to mention versions.
    We are using 11.1.1.7 and IE 9.
    I tried in Google but could not get the solution.
    Kindly let me know solution for this.
    PavanKumar

  • Data Services- The job server you selected is not working

    Long Text:
    After logging in to the Data Services designer,when try to run a job it shows error -The job server you selected is not working
    Latest Software version -BODS 4.0 SP2
    Reproduce Steps:
    1. Double click on the Project from repository, it will display the project in Project area.
    2. After that it will display all the jobs under the project.
    3.Right click on the job and try to execute, then it will display the "Execution Properties" windows.
    Here the we can the default Job Server has been selected.
    4. Try to click ok to execute the job and then we get the error-"The job server you selected is not working"

    Hi
    Please contact your Data services administrator to check on the server why the job server is not working.
    There might be several issues like connectivity with the repository, access details , mapping in the management console etc.
    And let us know the exact issue.
    Regards
    Puneet

  • Not able to put data selection condition in data selection tab of infopakag

    I was loading data from data source as data mart ( export data sauce from ODS) to other ODS.
    when I tried to do delta Initialization with data transfer , I am not able to put data selection condition in data selection tab of infopakage.
    when I choose Full Update in Update tab . It enables data selection fields in data selection tab. and I could put the condition.
    I have checked in transfer structure as well , the fields are marked for selection.
    Please advice .
    Please tell me what could be the reason for this problem

    Ashutosh,
    As you are doing delta upload the data selection tab will be disabled, if you want to do the selective load then you need to do init update with your selection.
    When you do the full updtae then definitely the data selection tab will be enabled for all the objects.
    Hope this helps...
    *******Assign Points if it helps********
    Thanks,
    Gattu

  • Delta field not enabled for selection in  generic data source

    Hi
    I have created a generic data source for the table VBFA....and for the delta pick up i have put the delta option as CALDAY on the field ERDAT...and  i have  selected that field for the selection option. but after i made it  delta enabled the selection option got disabled.
    Now when i check the info package delta selection tab that date column is not apperaing.
    But when i have to run the info package for the first i dont want all the data as it has a huge set of data.
    I wanted to  take only this months data.
    So is there any option to be set to enable this selection in info package.
    please suggest.
    Regards
    Shilpa

    Hi there,
    That's the stardard behaviour. If you use delta based om ERDAT, that field won't be available for selecting.
    You could for example try to build a view over VBFA, and let the field ERDAT there and another field, for example ZERDAT (that is just another alias for ERDAT). Create the delta based onyour view over the field (ERDAT), but you can still control the restrictions over the extractore with your ZERDAT.
    I don't know if this is possible, this is only an assumption.
    Another option could be first to create an extractor based on the table VBFA but without delta, that field ERDAT would be available. Do your full data restricting it, and after that, change your datasource to use deltas based on ERDAT. It will be unavailable than, but since you've already loaded previous full data, you could than use your delta like it is. But here, remember, your deltas will bring new and change data based on ERDAT. If it brings delta based on changed data over ERDAT to a record that you didn't brought over your full (only some data), it will be incorrect records.
    Also just an assumption, did not try it.
    Diogo.

  • Dimensions set to Selectable are not selectable w/in Smart View Data Forms

    When trying to use a data form by clicking "Select Form" in the Hyperion toolbar in Excel (not exporting from webspace), Dimensions that are defined as Selectable are not actually selectable within Smartview. Below is a portion of the script:
    BackgroundPOV=S#***.Y#***.w#***.V#***.I#***.C4#***
    SelectablePOVList=P{***}.E{***.[Base]}.C1{***.[Hierarchy]}
    Within the web, the form works fine and everything selectable is selectable. Within smart view, only Entity is selectable. Any insight would be greatly appreciated.
    SV Version 11.1.1.3.500
    HFM 11.1.1.3
    Excel 2007
    Edited by: JL on Aug 4, 2011 12:36 PM

    I have found this and its generally because the dimension is referenced in the column
    i.e Year and period is displayed in the column.
    In HFM you can select the members from the POV but when opening in SmartView you can't
    Solution is to remove the dimension from the col or row.
    Thanks
    G

  • HT1766 Can I "restore" my "Notes" on my iPhone and select the backup date?

    Can I "Restore" ny "Notes" from my backup and can I select the backup date. e.g. Backup a few days old..
    Thanks

    Backups are incremental.  You cannot select a set date.  In addition, you cannot select to restore only notes.  You must restore everything.

  • Select data where le date

    Hi,
    I have a select option (DTE) for date on selection screen. Now i want extract data from DB table to internal table where all dates shlod be LE from givin date in select option
    my select statment is :
    SELECT VBELN FKDAT KUNRG BSTNK_VF FROM VBRK INTO CORRESPONDING FIELDS OF TABLE ITAB_VBRK
    WHERE KUNRG IN CUST_NO AND FKDAT IN DTE.
    i m getiing data only EQ givin date. but i need all dates wich r LE from givin date.
    From Jitendra

    Hi ,
      An example of how this will work is as given below
    Data : it_1 type table of mara.
    select-options : s_matnr for mara-ersda.
    data : r_matnr like line of s_matnr.
    start-of-selection.
    loop at s_matnr into r_matnr.
    r_matnr-option = 'LE'.
    modify s_matnr from r_matnr.
    endloop.
    select * into table it_1
    from mara
    where ersda in s_matnr.
    data : wa like line of it_1.
    loop at it_1 into wa .
    write:/ wa-matnr.
    endloop.
    What this code will do is select all the materials from MARA where ERSDA is less than or equal to s_matnr-low.
    Try this and if you have any queries please do revert back.
    Regards
    Arun

  • Can not connect  to host  where the data base is hosted

    sql.free.fr is where the data base is hosted
    String host = "jdbc:mysql://sql.free.fr/
    her's the code
    public f()
    String pilote = "org.gjt.mm.mysql.Driver";
    String host = "jdbc:mysql://sql.free.fr/";
    String login = "login";
    String pw = "password";
    setTitle("Programmation avanc�e Java II (NicoWatt)");
    setSize(x,y);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    show();
    TM = new TMFromMysql(pilote,host,login,pw,"select * from TCar");
    JTable T = new JTable(TM);
    JScrollPane JSP = new JScrollPane(T);
    JSP.setPreferredSize(new Dimension(x,y));
    getContentPane().add(JSP,BorderLayout.CENTER);
    pack();
    }

    Basic network debugging:
    1. Try to ping the server; at the command line, type "ping sql.free.fr" and see what happens.
    If that fails then you have a network connectivity problem. Talk to the person who controls your network (the point where you connect to the Internet) and discuss it.
    2. Try to connect to the server at the same port that MySQL is using (normally 3306 but confirm that with the people running it); at the command line, type "telnet sql.free.fr 3306" and see if you get a connection.
    If that fails, then again you have a problem. Again discuss this with your network person. There are several reasons why these may fail (proxy servers, firewalls, and so on) and you will get better answers from people who know about the network then from random strangers on the Internet.

Maybe you are looking for