How can I use the join condition for this query?

Hi, i am using a query which has a sun query in it, wen i am running tat query it is giving 9332 records, I changed the sub query logic and given an inner join, but it is giving only 4476 records. So, I changed it to left join but it is giving more records
than usual now, say 10033 records.
This is the code which is giving records 9332, which is correct
select      distinct 
      b.SRC_PROV_ID
      ,COALESCE(a.SYSTEM_NAME, a.CTRCT_GRP_NAME, a.PROV_SMG_NAME) AS SYSTEM_NAME
INTO  TINtoSystem
from 
      RARE.dbo.EDW_MASTER a 
      Inner Join RARE.dbo.EDW_PROD_ID_XREF b 
            on a.SMG_ID = b.SMG_ID 
  where SRC_PLATFORM_CD = 'TX' 
      and a.SMG_ID in 
            select distinct 
            SMG_ID 
            from RARE.dbo.EDW_PROD_ID_XREF 
            where SRC_PLATFORM_CD = 'TX' 
            and SRC_PROV_ID in (select q.PROV_TAX_ID from PACT.dbo.SQS_EDW_Source q) 
I have changed this code by giving inner join as, but its not giving the exact records of 9332, 
select distinct
b.SRC_PROV_ID
,COALESCE(a.SYSTEM_NAME, a.CTRCT_GRP_NAME, a.PROV_SMG_NAME) AS SYSTEM_NAME
INTO TINtoSystem
from
RARE.dbo.EDW_MASTER a
Inner Join RARE.dbo.EDW_PROD_ID_XREF b
on a.SMG_ID = b.SMG_ID
Inner Join Pact.dbo.SQS_EDW_Source q
on b.SRC_PROV_ID = q.PROV_TAX_ID
where b.SRC_PLATFORM_CD = 'TX'
Can anyone tell, where it is missing, I used left join also but its giving more records then, need help

Hi, If you insist inner joins then please try
SELECT DISTINCT
b.SRC_PROV_ID
,COALESCE(a.SYSTEM_NAME, a.CTRCT_GRP_NAME, a.PROV_SMG_NAME) AS SYSTEM_NAME
INTO TINtoSystem
FROM
RARE.dbo.EDW_MASTER a
Inner Join RARE.dbo.EDW_PROD_ID_XREF b
on a.SMG_ID = b.SMG_ID
inner join
select distinct
c.SMG_ID
from RARE.dbo.EDW_PROD_ID_XREF as c
where SRC_PLATFORM_CD = 'TX'
and exists (select * from PACT.dbo.SQS_EDW_Source q where c.SRC_PROV_ID=q.PROV_TAX_ID)
) as d on a.SMG_ID = d.SMG_ID
where b.SRC_PLATFORM_CD = 'TX'

Similar Messages

  • I have a MacBook that is synced with my ipad.  My daughter has an Iphone4 and no computer.  How can we use the one computer for both devices that are unique?

    I have a MacBook that is synced with my ipad.  My daughter has an Iphone4 and no computer.  How can we use the one computer for both devices that are unique and keep them separate. thank you for your help!

    This should help:
    How to use multiple iPods, iPads, or iPhones with one computer
    Regards.

  • How do i get a list of all Roles defubed under a particular OrganizationalUnit? How can i use LDAPConnection.search method for this?

     

    Sorry for the typographical mistake.
    Please read the question as:"How do i get a list of all Roles defined under a particular OrganizationalUnit? How can i use LDAPConnection.search method for this?"

  • How can I use the same session for different components acroos application ?

    I am trying to include the components(chat, filesharing, whitboard) in different parts of my application. User should be able to access any of the component. We would like to have a single "ConnectSessionContainer" so that we don't see same user creating a seperate session for each component.
    Is there a better way of dealing with this other than declaring the "ConnectSessionContainer" in the main application ? Is there a way to check if we have a "ConnectSessionContainer" session already established ? Please help . Thanks.

    Thanks for the response. Let me explain what I am trying to do..
    I am trying to create components at different places(screens) of the flex application (not in the same .mxml file).
    Each time I create a component, I am using a "AdobeHSAuthenticator" and "ConnectSessionContainer" which is resulting a new participant in the room.
    For example
    screen1.mxml -
    <mx:Panel>
    <rtc:AdobeHSAuthenticator id="auth" authenticationSuccess="onAuthSuccess(event);" authenticationFailure="onAuthFailure(event);" />
    <rtc:ConnectSessionContainer id="mySession" >
            <rtc:Roster id="myRoster" width="100%" height="100%" />
            <rtc:Chat id="mychat" width="100%" height="100%" />
    </rtc:ConnectSessionContainer>
    </mx:Panel>
    screen2.mxml (in the same application) -
    <mx:Panel>
    <rtc:AdobeHSAuthenticator id="auth" authenticationSuccess="onAuthSuccess(event);" authenticationFailure="onAuthFailure(event);" />
    <rtc:ConnectSessionContainer id="mySession" >
            <rtc:SharedWhiteBoard id="wb" width="100%" height="100%" />
    </rtc:ConnectSessionContainer>
    </mx:Panel>
    Here, I open a screen1 and authenticate as UserA and when I try to open screen2 flex is considering me as another user though I am in the same application.
    1) How can I use different components which are in different flex files as a same User ?
    2) Should I place my <rtc:AdobeHSAuthenticator> and <rtc:ConnectSessionContainer> in the main application which calls the screen.mxml?
    3) What is the best way to do it ?
    Thanks for your time !

  • How can I use the value returned for a function into the macro ??

    I create a function to work in a macro and I would like to use the value of parameter f_calc_error returned by function in a condition like IF, but I don't know how can I do that. I have to use the macro function CALC_ERROR ??
      Thanks.
    Edson Suzuki

    Hi Edson,
    Yes you need to use the CALC_ERROR macro function to be able to test whether the last macro function returned an error. CALC_ERROR will return an 'X' if there an error occured during the execution of the last macro function.
    You can use a macro similar to the following:
    IF
      CALC_ERROR( )
      = 'X'
          DO SOMETHING HERE
    ENDIF
    Let me explain how this works internally. The SAP system maintains a global variable g_flg_calc_error during the execution of macros in the planning book. The g_flg_calc_error variable will contain the value of f_calc_error that was set by the last macro function which executed. The ABAP coding of a planning book is something like this:
    data: g_flg_calc_error type /SAPAPO/FLAG.
    * SAP will pass g_flg_calc_error variable to all macro
    * functions. When SAP calls a macro function, it does
    * something like this.
    call function '/SAPAPO/MACRO_FUNCTION_HERE'
            exporting
              plob_values      = i_s_adv_plob_values
              sdp_book         = g_c_advf_sdp_book
              sdp_view         = g_c_advf_sdp_view
            tables
              cols_index       = i_t_cols
              value_tab        = l_t_value_tab
            changing
              f_calc_error     = g_flg_calc_error
    As you can see, the g_flg_calc_error variable
    is passed in the "changing" part of the call. The macro  function being called can then use the f_calc_error
    variable to change the value of the global
    g_flg_calc_error variable. In fact, the macro function being called can also check (by looking at the f_calc_error variable) if the last macro function reported an error.  The CALC_ERROR macro function just checks the value of f_calc_error parameter (w/c in fact is the value of the g_flg_calc_error variable) and returns "true/X" if the f_calc_error was set to true by the last macro function.
    Hope this helps in clearing things out

  • How can I use the same contacts for two users

    MY wife and I are using the same account. I want to give her a seperate log in account (user). All is working fine excempt for "contacts". These are at the moment empty. How can I get our contacts also in her new contact list.
    Are there any other things I should also look for, in executing this exercise

    Hi Iemke Kuijper!
    I have two articles for you that will help you achieve this goal. First, here is an article on exporting your contacts files and importing them:
    Contacts: Export and import your contacts
    http://support.apple.com/kb/PH11586
    This next article will help you get the contacts file from your user account into your wife’s user account:
    OS X Mountain Lion: Share files with others who use your computer
    http://support.apple.com/kb/PH10636
    Thanks for using the Apple Support Communities!
    Cheers,
    Braden

  • TS1741 how can I use the remote app for my Apple TV when I am using the Apple TV away from home!?

    I'm traveling and using the Apple TV at the hotel but the remote app is not working cause I can't turn on home sharing from my p&amp;c, cause its not here

    Most hotels tend to require a login to the network via browser, which the ATV doesn't have. You won't be able to access the network for any functions if that's the case.
    You may want to contact someone at the hotel to clarify.

  • How can I use the onmouseover event in this case?

    Hello!
    Sorry If it's a simple question... I'm a beginner in JSFs :P...
    I need to do with a dataTable an effect.
    In my old JSP file (Basically made with HTML), when I made a TABLE, I changed the class of all the rows. Like this:
    <TABLE>
    <TR onmouseover="this.className='OnStyle'" onmouseout="this.className='OffStyle'">
    <TD>...</TD><TD></TD>
    </TR>
    </TABLE>All the row changes if the mouse was pointing at its.
    How can i do this with a simple dataTable? I have only 2 colums and a few rows :(
    Thanks a lot!

    Apparently JSF does not provide as simple solution to this simple task as one would expect. I've been looking for a solution to it myself but not found an answer.

  • How can i implement the default value for this variable?

    In one of our Stored procs,we have a variable RECS_TO_DELETE, which determines the number of records to delete from various DELETEs that happen within this proc.
    The value for RECS_TO_DELETE variable should be obtained from a configuration table sys_config
    select
    rec_num into RECS_TO_DELETE
    from sys_config
    where
    sys_code=55;
    But if something goes wrong with sys_config table or the above SELECT INTO, our client wants to makes sure that RECS_TO_DELETE should have a default value of 1000.
    In the code, how will i implement having this default value of 1000 for RECS_TO_DELETE variable  in case the above SELECT INTO fails for some reason.

    Hi,
    You have to assign a value before the execution...
    DECLARE
        RECS_TO_DELETE NUMBER(9) := 1000;
    BEGIN
        SELECT rec_num
        INTO   RECS_TO_DELETE
        FROM   sys_config
        WHERE  sys_code = 55;
        DBMS_OUTPUT.put_line(RECS_TO_DELETE);
    EXCEPTION
        WHEN NO_DATA_FOUND THEN
           DBMS_OUTPUT.put_line(RECS_TO_DELETE);
    END;
    /Regards,

  • [EWS][Java] How can I use the Search Filter only mails with attachments?

    Hey,
    I'm trying to search a folder ( doesn't matter  which ) for ONLY mails with attachments.
    How can I use the search filter for that purpose? 
    Thanks!

    You can drag the attachment collumn from settings and sort on that collumn
    In the main Outlook window, on the View menu, point to
    Current View, and then click Customize Current View.
    Click Fields. In the Available fields list, click the field that you want to add, and then click
    Add.
    Come back and mark replies as answer if they help, and help others with the same problem. If this post is helpful please vote it as Helpful on the left side.

  • HT4314 I have a game under one account, now I have an Itunes card under a different account, how can I use the $$$ in the card for the game I'm playing, I need to purchase different items for my game.

    I have been playing a game for a while under an account, now I have an Itunes card under a different account and would like to use that $$$ to purchase items for my game, but it doesn't let me because the game was downloaded under the original account. How can I use the $$$ in my new account?

    same here but i cant purchase a movie or anything

  • How can I use the "Copy and paste" tool in order get stamps in the same position in different pages (Acrobat XI for PC)?

    With Acrobat 6.0 I was able to copy a stamp in the same position (I mean "exactly" the same one) of different pages just by using the "copy/past" tool.
    Now I am using Acrobat XI and it seems like it is not possible anymore: I am copying a stamp and I am trying to past it in anoter page, but it appears in the center of the page (or wherever it wants to...).
    Does anyone have a solution?
    Thanks in advance.

    Thank you very much. I'll be waiting for you message.
    Messaggio originale----
    Da: [email protected]
    Data: 26/01/2015 17.56
    A: "Umberto Gangi"<[email protected]>
    Ogg:  How can I use the "Copy and paste" tool in order get stamps in the same position in different pages (Acrobat XI for PC)?
        How can I use the "Copy and paste" tool in order get stamps in the same position in different pages (Acrobat XI for PC)?
        created by Gilad D (try67) in Creating, Editing &amp; Exporting PDFs - View the full discussion
    Well, I was in the same situation so I've developed a tool that allows one to do it. I will send you some additional information about it in a private message.
         If the reply above answers your question, please take a moment to mark this answer as correct by visiting: https://forums.adobe.com/message/7132586#7132586 and clicking ‘Correct’ below the answer
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:
    Please note that the Adobe Forums do not accept email attachments. If you want to embed an image in your message please visit the thread in the forum and click the camera icon: https://forums.adobe.com/message/7132586#7132586
         To unsubscribe from this thread, please visit the message page at , click "Following" at the top right, &amp; "Stop Following"
         Start a new discussion in Creating, Editing &amp; Exporting PDFs by email or at Adobe Community
      For more information about maintaining your forum email notifications please go to https://forums.adobe.com/thread/1516624.

  • I have two iphones, different telcos, i am using the same apple id for both - how can i use the 10GB icloud free memory of my new iphone 5?

    I have two iphones, different telcos, i am using the same apple id for both - how can i use the 10GB icloud free memory of my new iphone 5?

    Thank you KiltedTim!
    YES, that is the free 5GB icloud memory for each apple ID. Can I not add the free 5Gb of my second Iphone to my original apple ID (5GB also) as I want to use one Apple ID name on both 2 Iphones? Is it necessary to have a different apple ID for the second Iphone to avail the free 5GB it carries with it?

  • HT1660 how can I use one single library for all users on the same laptop?

    how can I use one single library for all users on the same laptop?

    You are most of the way there. Each user having access to hard drive is the key. If users are limited in file privileges this is harder.
    Any files you add to your library and any files she adds to her library are available to the other. Just not automatically. Each user must add the files to their own library using the add file or add folder option from menu bar.
    What I have done is set library location to a location outside of My Documents\My Music. On my network storage I have a folder names s:\itunes. Both accounts iTunes are set to use this location for the library.

  • How can you use the same e-mail address for multiple ipads?

    I have two iPads.. an iPad and an ipad 2.  I registared my new ipad 2 and now my old ipad is will not let me log on and is telling me that my e-mail address is already in use.  how can you use the same e-mail address for multiple ipads?

    And by using the same Apple ID you can also share purchases.  If you have a different Apple ID for each iPhone then you can't share purchases.

Maybe you are looking for

  • Can't setup account on Itunes

    I bought my g/f an Ipod for christmas. She uses Windows XP and when trying to sign up for her account on Itunes it always says credit card processing is not avaliable at that time. We have been trying since Dec 22 and as of this morning it still isn'

  • Need help on mobile gaming development basic  {working the game main menu}

    package Assignment1; import java.io.IOException; import java.util.Random; import javax.microedition.lcdui.Canvas; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Graphics; import javax.microedition.lcdui.Image; import javax.m

  • Changing OSX default volume setting to a higher level in sound preferences

    When I change the default volume setting to a higher level in sound preferences within OSX, it is back at the lower level at the next listening session the following time I use iTunes on my Mac Mini. Within System Preferences there is a section that

  • Ctrl alt delete doesnt work anymore

    Hi, We have an HP probook G0 where the combination ctrl alt delete doesnt work anymore. - The issue is only with the left ctrl Key. When we use the right ctrl key, ctrl alt delete works - When I check the onscreen keyboard in windows, the left ctrl k

  • Working with time format in Numbers

    I am trying to subtract sunset time from sunrise time to determine length of daylight. When I imported data from an excel spreadsheet, the column I had the difference did not transfer correctly. I have tried unsuccessfully to subtract a sunset time,