Problem with Joins

Hi,
I am trying to write a query to join two tables and get the unmatched rows from the table.
For ex:
Employee Table:          Employee Labs
Emp_Id                Emp_L_ID
1                    1
2                    2
3                    5
4                    6
So what I want is the unmatched ID (3,4,5,6) over here?
Your suggestions would be greatly appreciated!

Well.
But I think writing code that's easy to read and understand should also be part of the "ideas" passed to the OP.
And an experienced programmer shoul do that by reflex out of the spinal cord.Certainly - but when we are payed for it - in a forum the start must be more explanatory
And IMHO unnessesarry nested queries are not easy to understand...Maybe, but the steps towards the solution (something the OPs definitely needs) are shown clearly
But I have to admit that you got a clearer understanding of the OP's reqest...Well for this time
I'm here principally to learn as I never know when I might need something and getting so much from the forum I feel I must give something back too (the points awarded are just a collateral damage )
Regards
Etbin

Similar Messages

  • AP 2700 - 2 MAC addresses - problem with joining to the WLC

    Hi,
    I had a problem with joining my new AP 2700 to the controller. I've found workaround but I would like to ask you if you know if this behavior is a some kind of bug or maybe feature :)
    I have DHCP server which assigns IP address base on the binding MAC address with the IP address. Without binding, IP won't be assigned so I added MAC address from the AP sticker (MAC and SN number is on the sticker at the back of each AP) to the DHCP, connected AP to the switch port which was configured exactly the same way like other ports on this switch where older AP are working fine and.... nothing. IP address was not assigned. There was no DHCP request in the DHCP server logs.
    During the investigation I've found that AP present 2 MAC addresses on the switch interface:
    switch#sh mac address-table interface fa1/1
    Mac Address Table
    Vlan Mac Address Type Ports
    11 58f3.54c1.2cb3 DYNAMIC Fa1/1
    11 58f3.54c1.2cb4 DYNAMIC Fa1/1
    The first one (58f3.54c1.2cb3) is a "sticker" MAC address but the second one (58f3.54c1.2cb4) is something new. Looking in to the DHCP logs I've found log that this second MAC address (58f3.54c1.2cb4) tried to get IP address but it was not possible because this MAC was not binding with any IP address so DHCP server refuse. I added this second MAC (58f3.54c1.2cb4) to the DHCP server, AP get IP address, join to the WLC, download software, reboot and ... this MAC address disappear.
    switch#sh mac address-table interface fa1/1
    Mac Address Table
    Vlan Mac Address Type Ports
    11 58f3.54c1.2cb3 DYNAMIC Fa1/1
    Software I had on the AP before joining to the WLC was:
    Version :
    Cisco IOS Software, C2700 Software (AP3G2-RCVK9W8-M), Version 15.2(4)JB5, RELEASE SOFTWARE (fc1)
    now I have (after downloaded from the WLC)
    Version :
    Cisco IOS Software, C2700 Software (AP3G2-K9W8-M), Version 15.2(4)JB6, RELEASE SOFTWARE (fc1)
    Do anyone know what happen?

    (WLC1) >show sysinfo
    Manufacturer's Name.............................. Cisco Systems Inc.
    Product Name..................................... Cisco Controller
    Product Version.................................. 7.6.130.0
    Bootloader Version............................... 1.0.20
    Field Recovery Image Version..................... 7.6.95.16
    Firmware Version................................. FPGA 1.7, Env 1.8, USB console 2.2
    Build Type....................................... DATA + WPS
    System Name...................................... WLC1
    System Location..................................
    System Contact...................................
    System ObjectID.................................. 1.3.6.1.4.1.9.1.1069
    Redundancy Mode.................................. Disabled
    IP Address....................................... 10.10.10.10
    Last Reset....................................... Software reset
    System Up Time................................... 25 days 2 hrs 53 mins 5 secs
    System Timezone Location.........................
    System Stats Realtime Interval................... 5
    System Stats Normal Interval..................... 180
    Configured Country............................... US - United States
    Operating Environment............................ Commercial (0 to 40 C)
    Internal Temp Alarm Limits....................... 0 to 65 C
    Internal Temperature............................. +44 C
    External Temperature............................. +22 C
    Fan Status....................................... OK
    State of 802.11b Network......................... Enabled
    State of 802.11a Network......................... Disabled
    Number of WLANs.................................. 6
    Number of Active Clients......................... 25
    Burned-in MAC Address............................ XX:XX:XX:XX:XX:XX
    Power Supply 1................................... Present, OK
    Power Supply 2................................... Present, OK
    Maximum number of APs supported.................. 25
    (WLC1) >show time
    Time............................................. Thu Apr 9 13:51:00 2015
    Timezone delta................................... 0:0
    Timezone location................................
    NTP Servers
    NTP Polling Interval......................... 3600
    Index NTP Key Index NTP Server NTP Msg Auth Status
    1 0 10.10.10.11 AUTH DISABLED
    It's look like AP doesn't allow for console login or commands it just only show activity. After rebooting the WLC I get information:
    Cisco IOS Software, C2700 Software (AP3G2-RCVK9W8-M), Version 15.2(4)JB5, RELEASE SOFTWARE (fc1)

  • Hi! Everyone, I have some problems with JOIN and Sub-query; Could you help me, Please?

    Dear Sir/Madam
    I'm a student who is interested in Oracle Database and
    I have some problems with JOIN and Sub-query.
    I hope so many of you could help me.
    if i use JOIN without sub-query, may it be faster or not?
    SELECT field1, field2 FROM tableA INNER JOIN tableB
    if i use JOIN with sub-query, may it be faster or not?
    SELECT field1,field2,field3 FROM tableA INNER JOIN (SELECT field1,field2 FROM tableB)
    Thanks in advance!

    Hi,
    fac30d8e-74d3-42aa-b643-e30a3780e00f wrote:
    Dear Sir/Madam
    I'm a student who is interested in Oracle Database and
    I have some problems with JOIN and Sub-query.
    I hope so many of you could help me.
    if i use JOIN without sub-query, may it be faster or not?
    SELECT field1, field2 FROM tableA INNER JOIN tableB
    if i use JOIN with sub-query, may it be faster or not?
    SELECT field1,field2,field3 FROM tableA INNER JOIN (SELECT field1,field2 FROM tableB)
    Thanks in advance!
    As the others have said, the execution plan will give you a better idea about which is faster.
    If you're trying to see how using (or not using) a sub-query affects performance, make the rest of the queries as similar as possible.  For example, include field3 in both queries, or ignore field3 in both queries.
    In this particular case, I guess the optimizer would do the same thing either way, but that's just a guess.  I can't see your execution plans.
    In general, simpler code is faster, and better in other ways, too.  In this case
    tableB
    is simpler than
    (SELECT field1, field2  FROM tableB)
    Why do you want a sub-query in this example?

  • Problem with joined piece under Exchange

    I have two mail box one in Notes8.5 and a new one in Exchage 2010. When I receive a mail with a joined peice like a pdf when I want to use it by press it, in Notes no problem I can select the Application but under Exchange it's charged charged but nothing I can select application. It's a problem with Exchange or I have to do something with applications?

    UPDATE: The problem has been fixed. It turned out I had a different alias than my login in my account, which was confusing things. Getting rid of it fixed the problem.

  • Emac G4 problems with joining Airport Extreme network

    I have an Airport Extreme network with two Airport Express base stations. The Airport Extreme is connected to the internet via ethernet/cable modem. The imac and the base stations work fine and I have no problem with my internet access on the imac, but I can't get internet access via the emac. It appears that the emac is connected to the network, but I get an error message ("Can't find server") when I try to access the internet. What have I done wrong?
    imac G5 isight   Mac OS X (10.4.4)   Other computer: emac G4, operating system 10.3.9

    Is the eMac connected wirelessly to the network?
    It may be a DNS issue, see KB 106798, Mac OS: Troubleshooting "A connection failure has occurred", "The specified server could not be found" or Similar Messages.

  • Problem with Join Queries using PHP and an Orcale Database

    Ok, I am trying to build a simple php querying tool for my oracle database and for the most part it is working however I am having a problem getting data from my join queries. If I run the following query :
    QUERY:
    SELECT lastfirst,EnteredBy,Debit FROM students sts JOIN GLDetail gl ON gl.studentid=sts.id
    RESULT SET:
    Lastfirst     EnteredBy     Debit
    caiu, test      204     1
    But when I run the query correctly I get no results
    QUERY:
    SELECT sts.lastfirst,gl.EnteredBy,gl.Debit FROM students sts JOIN GLDetail gl ON gl.studentid=sts.id
    RESULT SET:
    sts.lastfirst     gl.EnteredBy     gl.Debit
    and if I run the query combining the two above methods and adding a field (schoolid) that has the same name on both table I get the following result sets
    QUERY:
    SELECT lastfirst,EnteredBy,Debit,sts.schoolid FROM students sts JOIN GLDetail gl ON gl.studentid=sts.id
    RESULT SET:
    lastfirst     EnteredBy     Debit     sts.schoolid
    caiu, test      204     1     
    QUERY:
    SELECT lastfirst,EnteredBy,Debit,schoolid FROM students sts JOIN GLDetail gl ON gl.studentid=sts.id
    RESULT SET:
    NONE
    Therefore, I have to have something written incorrectly in my php code and I just can not figure it out. My entire code is pasted below please provide me with an assistance you might have to offer. I have change the odbc_connec line so I could post it to this forum. In addition, I had to phrase out the column headers there for when you write the column headers you have to use ~ instead of , as the separator and then I turn back into the correct format for sql.
    //These scripts just open help windows if somone clicks on the icon
    <script>
    function submit()
    {document.sqlform.submit();}
    </script>
    <script>
    function colwin(){
    window.open("colnames.php",null,"height=300,width=400,scrollbars=1");}
    </script>
    <script>
    function tabwin(){
    window.open("tablenames.php",null,"height=300,width=400,scrollbars=1");}
    </script>
    <script>
    function help(){
    window.open("http://www.w3schools.com/sql/default.asp",null,"height=500,width=700,scrollbars=1");}
    </script>
    <form method="post" action="<?php echo $PHP_SELF;?>" name="sqlform">
    <?php
    //Cookie to check for authorization to the site
    if($_COOKIE['cookie']=="CheckCookieForAuth")
    //These get the values of the textareas after the form has been submitted
    $sqlSELECT = $_POST["SELECT"];
    $sqlFROM = $_POST["FROM"];
    $sqlJOIN = $_POST["JOIN"];
    $sqlWHERE = $_POST["WHERE"];
    $sqlOTHER = $_POST["OTHER"];
    $sqlSELECTTYPE = $_POST["SELECTTYPE"];
    //This is the variable used to parse out my headers the user entered
    $sqlColNames = split('~',$sqlSELECT);
    //This converts the ~ separator to , so I can actually use it as part of my sql string
    $search = array('~');
    $replace = array(',');
    $mystring = $sqlSELECT;
    $sqlString = str_replace($search, $replace, $mystring);
    //These are the textareas and the drop down options that the end users has to create queries
    echo "<table border=0>";
    echo "<tr><td valign='top'>";
    echo "<B>SELECT TYPE</B> <BR><SELECT NAME=SELECTTYPE>
    <OPTION VALUE='SELECT' SELECTED>SELECT</OPTION>
    <OPTION VALUE='SELECT DISTINCT'>SELECT DISTINCT</OPTION>
    <OPTION VALUE='INSERT'>INSERT</OPTION>
    <OPTION VALUE='UPDATE'>UPDATE</OPTION>
    <OPTION VALUE='DELETE'>DELETE</OPTION>
    </SELECT>";
    echo "</td><td>";
    echo "<textarea rows=2 cols=75 name=SELECT wrap=physical>$sqlSELECT</textarea>";
    echo "</td><td valign='top'>";
    echo "<img src='images/sqlC.jpg' width='25' height='25' onclick='colwin()'>";
    echo "</td></tr>";
    echo "<tr><td valign='top'>";
    echo "<b>FROM</b>";
    echo "</td><td>";
    echo "<textarea rows=2 cols=75 name=FROM wrap=physical>$sqlFROM</textarea>";
    echo "</td><td valign='top'>";
    echo "<img src='images/sqlT.jpg' width='25' height='25' border=0 onclick='tabwin()'>";
    echo "</td></tr>";
    echo "<tr><td valign='top'>";
    echo "<b>JOIN</b>";
    echo "</td><td>";
    echo "<textarea rows=2 cols=75 name=JOIN wrap=physical>$sqlJOIN</textarea>";
    echo "</td></tr>";
    echo "<tr><td valign='top'>";
    echo "<b>WHERE</b>";
    echo "</td><td>";
    echo "<textarea rows=2 cols=75 name=WHERE wrap=physical>$sqlWHERE</textarea>";
    echo "</td></tr>";
    //This is where the end user would enter group by, having, order by, etc..
    echo "<tr><td valign='top'>";
    echo "<b>OTHER</b>";
    echo "</td><td>";
    echo "<textarea rows=2 cols=75 name=OTHER wrap=physical>$sqlOTHER</textarea>";
    echo "</td></tr>";
    This is a run query icon and a help icon
    echo "<tr><td colspan=2 align=right>";
    echo "<img src='images/RunQuery.jpg' width='30' height='28' onclick='submit()'> <img src='images/qm.jpg' border=0 width='25' height='25' onclick='help()'>";
    echo "</td></tr></table>";
    echo "<br>";
    echo "<br>";
    //This is where I connect to my remote oracle database
         $conn=odbc_connect('ODBC_ConnectionName','USERNAME','PASSWORD');
    //This is the sql string created by the end users
         $sql="$sqlSELECTTYPE $sqlString FROM $sqlFROM $sqlJOIN $sqlWHERE $sqlOTHER";
    //This executes the connection string and the sql string
         $rs=odbc_exec($conn,$sql);
    //This will display the query or a message if the query is empty
         if($rs!=NULL){
         echo "<table border=1>";
         echo "<tr>";
    //This loops through the string array the end user enter the field name text area to get column headers
         for($i=0; $i<count($sqlColNames); $i++)
         echo "<td>";
         print_r($sqlColNames[$i]);
         echo "</td>";
         echo "</tr><tr>";
    //This actually fetchs the rows from the statement and then display the data based on the column names the end user speificed
         while (odbc_fetch_row($rs))
              for($i=0; $i<count($sqlColNames); $i++)
                   $results=odbc_result($rs,$sqlColNames[$i]);
                   echo "<td>$results</td>";
              echo "</tr>";
         odbc_close($conn);
         echo "</table>";}else{echo "Results will be displayed here";}
    echo "<br><br>";
    echo $sql;
    else
    echo "Not logged in";
    ?>
    </form>

    This looks more like a SQL question than a PHP issue. There are a couple of JOIN examples at http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_10002.htm#i2066611 that might you work through the problem.

  • Select Problem with Joined tables

    Hello everyone I have the following Query
    SELECT
        OBJEKTI.OBJEKAT_ID OBJEKAT_ID,
        OBJEKTI.ADRESA ADRESA,
        OBJEKTI.POVRSINA POVRSINA,
        OBJEKTI.BROJ_IZVRSILACA BROJ_IZVRSILACA,
        OPREMLJENOSTI.OPREMLJENOST_ID OPREMLJENOST_ID,
        OPREMLJENOSTI.PULT PULT,
        OPREMLJENOSTI.REKLAMA REKLAMA,
        OPREMLJENOSTI.MOKRI_CVOR MOKRI_CVOR,
        OPREMLJENOSTI.WC_ZA_IGRACE WC_ZA_IGRACE,
        OPREMLJENOSTI.WC_ZA_OSOBLJE WC_ZA_OSOBLJE,
        OPREMLJENOSTI.VENTILATOR VENTILATOR,
        OPREMLJENOSTI.OSVJETLJENJE OSVJETLJENJE,
        OPREMLJENOSTI.VRSTA_BROJILA VRSTA_BROJILA,
        OPREMLJENOSTI.ELEKTRO_INSTALACIJE ELEKTRO_INSTALACIJE,
        OPREMLJENOSTI.VODO_INSTALACIJE VODO_INSTALACIJE,
        OPREMLJENOSTI.TELEFONSKE_INSTALACIJE TELEFONSKE_INSTALACIJE,
        OPREMLJENOSTI.GRIJANJE_ID GRIJANJE_ID,
        OPREMLJENOSTI.POD_ID POD_ID,
        OPREMLJENOSTI.PROZORI_VRATA_ID PROZORI_VRATA_ID,
        OPREMLJENOSTI.OBJEKAT_ID OBJEKAT_ID1,
        TEHNICKE_OPREMLJENOSTI.TEH_OPR_ID TEH_OPR_ID,
        TEHNICKE_OPREMLJENOSTI.ONLINE_KLADIONICA ONLINE_KLADIONICA,
        TEHNICKE_OPREMLJENOSTI.PANO PANO,
        TEHNICKE_OPREMLJENOSTI.NOSACI NOSACI,
        TEHNICKE_OPREMLJENOSTI.TV_LCD TV_LCD,
        TEHNICKE_OPREMLJENOSTI.TV_TELETEXT TV_TELETEXT,
        TEHNICKE_OPREMLJENOSTI.APARATI_IGRE APARATI_IGRE,
        TEHNICKE_OPREMLJENOSTI.EVONA EVONA,
        TEHNICKE_OPREMLJENOSTI.NOVOMATIC NOVOMATIC,
        TEHNICKE_OPREMLJENOSTI.RULET RULET,
        TEHNICKE_OPREMLJENOSTI.BILIJAR BILIJAR,
        TEHNICKE_OPREMLJENOSTI.KLIMA KLIMA,
        TEHNICKE_OPREMLJENOSTI.OBJEKAT_ID OBJEKAT_ID2,
        PONUDE.PONUDA_ID PONUDA_ID,
        PONUDE.ONLINE_TERMINAL ONLINE_TERMINAL,
        PONUDE.SRECKE SRECKE,
        PONUDE.ONLINE_KLADIONICA ONLINE_KLADIONICA1,
        PONUDE.APARATI_IGRE APARATI_IGRE1,
        PONUDE.RULET RULET1,
        PONUDE.BILIJAR BILIJAR1,
        PONUDE.OBJEKAT_ID OBJEKAT_ID3
    FROM
        OBJEKTI,
        OPREMLJENOSTI,
        TEHNICKE_OPREMLJENOSTI,
        PONUDE
    WHERE
    (PONUDE.OBJEKAT_ID=OBJEKTI.OBJEKAT_ID AND TEHNICKE_OPREMLJENOSTI.OBJEKAT_ID=OPREMLJENOSTI.OBJEKAT_ID) OR (OPREMLJENOSTI.OBJEKAT_ID=OBJEKTI.OBJEKAT_ID AND TEHNICKE_OPREMLJENOSTI.OBJEKAT_ID=OPREMLJENOSTI.OBJEKAT_ID)
    ORDER BY OBJEKTI.OBJEKAT_IDThe problem I get is no matter what WHERE clause I use I get doubled values which makes no sense. I checked in the tables and I don't have any doubled values. Each Opremljenost has 1 objekat (there are 2 rows each with its own Objekat) and the same applies to the other 2 tables (PONUDE and TEHNICKE OPREMLJENOSTI) but for some reason they double up the values. If I run it without a where clause at all I get some values repeat itself up to 4 times. Does anyone have a clue what is wrong with my query?

    You are joining a parent table (OBJEKTI) with three child tables (the other three: PON, TEH, OPR).
    Whenever you do that, you will always get duplication of child-rows, if there are multiple child-rows for a parent-row in any of the three child tables.
    For example, let P be a parent table, with two child tables, say C1 and C2.
    Contents:
    Table P:
    p1
    Table C1 (has two rows for row p1):
    1 p1
    2 p1
    Table C2 (has three rows for row p1):
    10 p1
    20 p1
    30 p1If you now do this:
    select P.*,C1.*,C2.*
    from P, C1, C2
    where [join P with C1]  and [join P with C2]Then your result set will look like this:
    P.p1  C1.1  C1.p1  C2.10  C2.p1
    P.p1  C1.1  C1.p1  C2.20  C2.p1
    P.p1  C1.1  C1.p1  C2.30  C2.p1
    P.p1  C1.2  C1.p1  C2.10  C2.p1
    P.p1  C1.2  C1.p1  C2.20  C2.p1
    P.p1  C1.2  C1.p1  C2.30  C2.p1As you can see every C1 row is duplicated three times in the resultset (due to join with C2).
    And every C2 row is duplicated two times in the resultset (due to join with C1).
    This is simply what happens if you join a parent table with multiple child tables...
    Question now is: what is the expected result that you are looking for?

  • Problem with joining 3 tables

    Hi,
    The following is my join code and internal table declaration:
    BEGINOF/ENDOF INTERNAL TABLE
    DATA: BEGIN OF I_MARC_VALUES OCCURS 0,
            WERKS LIKE MARC-WERKS,
            DISPO LIKE MARC-DISPO,
            DISMM LIKE MARC-DISMM,
            ZZLIFNR LIKE MARC-ZZLIFNR,
            MMSTA LIKE MARC-MMSTA,
            MATNR LIKE MARA-MATNR,
            MAKTX LIKE MAKT-MAKTX,
            EKGRP LIKE MARC-EKGRP,
          END OF I_MARC_VALUES.
    SELECT
    MARC~WERKS
    MARC~DISPO
    MARC~DISMM
    MARC~ZZLIFNR
    MARC~MMSTA
    MARA~MATNR
    MAKT~MAKTX
    MARC~EKGRP
    FROM MARC
    INNER JOIN MARA ON MARAMATNR = MARCMATNR
    INNER JOIN MAKT ON MAKTMATNR = MARCMATNR
    INTO CORRESPONDING FIELDS OF TABLE I_MARC_VALUES
    WHERE EKGRP =  P_GROUP.
    BREAK-POINT.
    WRITE: / I_MARC_VALUES.
    However, the output produces a blank screen.
    What is the problem and what can i do to solve it?
    Points will be rewarded and all answers will be greatly appreciated.
    Thank You,
    John

    Hi john,
    Use the loop stamemnt and don't go for inner join, better use for all entries,so that ur processing will be faster..
    REPORT  ZNEW                                    .
    PARAMETER P_GROUP TYPE MARC-EKGRP.
    *BEGINOF/ENDOF INTERNAL TABLE
    DATA: BEGIN OF I_MARC_VALUES OCCURS 0,
    WERKS LIKE MARC-WERKS,
    DISPO LIKE MARC-DISPO,
    DISMM LIKE MARC-DISMM,
    *ZZLIFNR LIKE MARC-ZZLIFNR,
    MMSTA LIKE MARC-MMSTA,
    MATNR LIKE MARA-MATNR,
    MAKTX LIKE MAKT-MAKTX,
    EKGRP LIKE MARC-EKGRP,
    END OF I_MARC_VALUES.
    SELECT
    MARC~WERKS
    MARC~DISPO
    MARC~DISMM
    *MARC~ZZLIFNR
    MARC~MMSTA
    MARA~MATNR
    MAKT~MAKTX
    MARC~EKGRP
    FROM MARC
    INNER JOIN MARA ON MARAMATNR = MARCMATNR
    INNER JOIN MAKT ON MAKTMATNR = MARCMATNR
    INTO CORRESPONDING FIELDS OF TABLE I_MARC_VALUES
    WHERE EKGRP = P_GROUP.
    *BREAK-POINT.
    LOOP AT I_MARC_VALUES.
    WRITE: / I_MARC_VALUES-WERKS.
    ENDLOOP.
    try with this program..It's executing..
    Reward if it's useful..
    Reg,
    Manoj.

  • Problem with Joining Tables in VC

    Hi All,
    I am developing custom portal activity report in VC. I need to join WCR_USERPAGEUSAGE, WCR_WEBSTATCONTENT  tables. I dont have access for SQL Editor. I have used Freeform query template in BI Integration wizard and created dataservice in that joined these tables. Here I couldn,t pass parameters to this dataservice. If I pass parameter , It shows application error as null. How can I solve this problem?.
    Thanks & Regards,
    Art

    Hi Art,
    could you describe your solution, so that other users with the same issues can find help here on SDN?
    Best Regards,
    Marcel

  • Problem with Join Statement

    hay guys
                 I have written a query in ABAP OO to join 2 tables and have output in different table.Here i want only selected fields in 3 table .I dont know why this query is giving erroe.Help needed. 
    TYPES : BEGIN OF ty_catsubcat,
              CATEGORYID type ZNCYID,
              DESCRIPTION_CAT TYPE ZNCYID,
              SUBCATID type ZNSBCYID,
              DESCRIPTION_SUBCAT type ZNSBDS,
              END OF ty_catsubcat.
    DATA :   IT_CATSUBCAT TYPE TABLE OF  ty_catsubcat.
      Select ZNCYMS~CATEGORYID ZNCYMS~DESCRIPTION ZNSBCYMS~SUBCATID ZNSBCYMS~DESCRIPTION
             INTO (IT_CATSUBCAT-CATEGORYID,
                      IT_CATSUBCAT-DESCRIPTION_CAT,
                      IT_CATSUBCAT-SUBCATID,
                      IT_CATSUBCAT-DESCRIPTION_SUBCAT)
             FROM ZNCYMS INNER JOIN ZNSBCYMS
             ON   ZNCYMS~CATEGORYID = ZNSBCYMS~CATEGORYID
             order by ZNCYMS~CATEGORYID.
      endselect.

    A few issues..
    Your table it_catsubcat does not have a header line, and you are trying to insert into the header area of the table which does not exist.  Either declare a work area/header, or do a table fetch instead.
      Select ZNCYMSCATEGORYID ZNCYMSDESCRIPTION ZNSBCYMSSUBCATID ZNSBCYMSDESCRIPTION
            <b> INTO CORRESPONDING FIELDS OF TABLE IT_CATSUBCAT</b>
             FROM ZNCYMS INNER JOIN ZNSBCYMS
             ON   ZNCYMSCATEGORYID = ZNSBCYMSCATEGORYID
             order by ZNCYMS~CATEGORYID.
    If you use a work area to insert into, then you need to append the work area to your internal table.
    data: IT_CATSUBCAT TYPE TABLE OF  ty_catsubcat with header line.
    Select ZNCYMSCATEGORYID ZNCYMSDESCRIPTION ZNSBCYMSSUBCATID ZNSBCYMSDESCRIPTION
             INTO (IT_CATSUBCAT-CATEGORYID,
                      IT_CATSUBCAT-DESCRIPTION_CAT,
                      IT_CATSUBCAT-SUBCATID,
                      IT_CATSUBCAT-DESCRIPTION_SUBCAT)
             FROM ZNCYMS INNER JOIN ZNSBCYMS
             ON   ZNCYMSCATEGORYID = ZNSBCYMSCATEGORYID
             order by ZNCYMS~CATEGORYID.
    append it_catsubcat.
    endselect.

  • Problem with joining tables in cmp bean

    This is for an informix database. when i specify to join tables in CMP beans i get a sql error.. this is what the SQL join statement looks like when the server spits it out:
    SELECT t0.id, t0.name, t0.available, t0.available_date FROM drs_product t0, outer drs_category t1 ON t0.style=t1.style WHERE t0.available = 'T'
    it puts the "ON" string into the join?? this gives me a SQL error, it's supposed to be like this:
    SELECT t0.id, t0.name, t0.available, t0.available_date FROM drs_product t0, outer join drs_category t1 WHERE t0.style=t1.style AND t0.available = 'T'
    how can i fix this

    nevermind..i figured it out again.. in the INFORMIX DYNAMIC SERVER.properties file replace the left join attribute with this:
    LEFT_JOIN= left join
    make sure there is a space before the "l" in left and a space after the "n" in join, otherwise it will be a sql error:
    the previously LEFT_JOIN=, outer statement is clearly wrong for this database.

  • Problem with join / explicit field declaration does not work

    Hello together,
    there is something I do not understand about the join. I have a join over two tables (see below). The field AENAM exists in both tables but I want to have it coming from ZDPP_VERBRAUCEFF.
    BUT the system gives me the values from MARA although I define the source ZDPP_VERBRAUCEFF.
      SELECT zdpp_verbrauceff~mandt
             zdpp_verbrauceff~matnr
             zdpp_verbrauceff~zzmdv01
             zdpp_verbrauceff~begda
             zdpp_verbrauceff~endda
             zdpp_verbrauceff~vmeng
             zdpp_verbrauceff~vmeng_m
             zdpp_verbrauceff~aenam     "Problem
             zdpp_verbrauceff~aedat
             zdpp_verbrauceff~aezet
             zdpp_verbrauceff~prfdt
             zdpp_verbrauceff~prfzt
        FROM zdpp_verbrauceff
        INNER JOIN mara
        ON zdpp_verbrauceffmatnr = maramatnr
        INTO TABLE lt_ver_db
        WHERE zdpp_verbrauceff~zzmdv01 IN s_mdv01
          AND zdpp_verbrauceff~begda   <= s_datum-high
          AND zdpp_verbrauceff~endda   >= s_datum-low
          AND mara~mtart               IN s_mtart
          AND mara~matnr               IN s_matnr.
    Can anybody tell me what I doing wrong?
    Thanks in advance,
    Sebastian

    Can you try change the statment sequence as I have below and see if this works i.e:
    SELECT zdpp_verbrauceff~mandt
    zdpp_verbrauceff~matnr
    zdpp_verbrauceff~zzmdv01
    zdpp_verbrauceff~begda
    zdpp_verbrauceff~endda
    zdpp_verbrauceff~vmeng
    zdpp_verbrauceff~vmeng_m
    zdpp_verbrauceff~aenam "Problem
    zdpp_verbrauceff~aedat
    zdpp_verbrauceff~aezet
    zdpp_verbrauceff~prfdt
    zdpp_verbrauceff~prfzt
    FROM zdpp_verbrauceff
    INTO TABLE lt_ver_db   "LINE MOVED to here
    INNER JOIN mara
    ON zdpp_verbrauceffmatnr = maramatnr
    WHERE zdpp_verbrauceff~zzmdv01 IN s_mdv01
    AND zdpp_verbrauceff~begda <= s_datum-high
    AND zdpp_verbrauceff~endda >= s_datum-low
    AND mara~mtart IN s_mtart
    AND mara~matnr IN s_matnr.
    Regards,
    Warren.

  • Problem with JOINs in SELECT query

    The parameter  wa_dob-e_dob is not getting its definition ....
    it contains DOB in current yr.
    As i am using Joins also Workarea.... so is it coz Joins & WA cant be used simultaneously in a SELECT query....
    Is there any other option to do the same...?
    *  Global Structure
    TYPES : BEGIN OF t_data ,                     "Structure
            emp_dob TYPE pa0002-gbdat,
            emp_Mailid TYPE pa0105-usrid,
           END OF t_data,
           BEGIN OF t_dob,
           e_dob TYPE pa0002-gbdat,
           e_pernr type pa0002-pernr,
           END OF t_dob.
    *  Global Internal Tables (I_)
    DATA : i_data TYPE TABLE OF t_data,           "Internal Table for output data
           i_dob TYPE TABLE OF t_dob.             "Internal table for Dob
    *  Global Work Area (WA_)
    DATA : wa_data TYPE  t_data,                  "Work Area for output data
           wa_dob TYPE  t_dob.                    "Work Area for Dob
    *this is the query where i am getting error
    * Field "WA_DOB-E_DOB" Not found.
    LOOP AT i_dob INTO wa_dob.
        SELECT pa0002~gbdat pa0105~usrid INTO CORRESPONDING FIELDS OF wa_data
          FROM pa0002
          INNER JOIN pa0105
          ON pa0002~pernr = pa0105~pernr
          WHERE  pa0105~subty EQ 'MAIL' AND
         wa_dob-e_dob BETWEEN w_sysdate AND w_edit_sysdate.
        ENDSELECT.
        APPEND wa_data TO i_data.
        CLEAR wa_data.
        CLEAR wa_dob.
        CLEAR l_temp_dob.
      ENDLOOP.

    Hi,
    you are checking the work area in the SELECT. IN WHERE condition of the select u should specify fields in either of the tables pa0002 , pa0105 for data population.
    The select is on the database table and not on the work area.for checking the data in the work area do this way:
    loop at it_dob into wa_dob.
    if wa_dob-e_dob between the range u want (w_sysdate AND w_edit_sysdate)
    endif.
    endloop.
    ie: wa_dob-e_dob >w_sysdate AND wa_dob-e_dob < w_edit_sysdate or
        wa_dob-e_dob < w_sysdate AND wa_dob-e_dob  >  w_edit_sysdate
    watever ur requirement is..
    regards,
    madhu

  • Problem with joining tracks

    Have been using the Join tracks function for a long time and know how to do it, but for some reason the past few days it won't come up in the options

    Did you delete the files completely by moving them to the recycle bin, then emptying it?
    Also just have a read of this. Need to check whether you've seen it or not.
    http://docs.info.apple.com/article.html?artnum=93624

  • Problem in join with hrp1000 and hrp1001???

    Hi all, I am pasting code sAmpLE, i am having problem with join, without join the query is working. Help out.
    IF per_no IS NOT INITIAL.
        SELECT objid sobid objid INTO TABLE lt_st_p1
          FROM hrp1001 WHERE otype EQ 'P' AND objid IN per_no
          AND plvar EQ lv_plan_version AND rsign EQ 'B' AND relat EQ '008' AND istat EQ '1'
           AND subty EQ 'B008' AND sclas EQ 'S'.
       LOOP AT lt_st_p1 INTO ls_st_p1_tem.
         ls_st_p1_tem-sobid1 = ls_st_p1_tem-pernr.
         MODIFY lt_st_p1 FROM ls_st_p1_tem TRANSPORTING sobid1.
       ENDLOOP.
        check lt_st_p1 is not INITIAL.
        SELECT h1objid h1sobid h0~stext INTO TABLE lt_st_p1_temp
          FROM hrp1001 AS h1 JOIN hrp1000 as h0 on ( h1objid eq h0objid and h1rsign eq h0otype )
          FOR ALL ENTRIES IN lt_st_p1
          WHERE h1otype EQ 'O' AND h1sobid = lt_st_p1-sobid
          AND h1plvar EQ lv_plan_version AND h1relat EQ '003'
          AND h1rsign EQ 'B' AND h1istat EQ '1' AND h1subty EQ 'B003' AND h1sclas EQ 'S'
    I want to get the stext of the braNCH. THE lt_st_p1 is having the emp id and position. and i want to get branch , position and stext( of branch) in lt_st_p1_temp by the help of join. I am implementing this qauery, but is getting subrc 4, what is the problem in this , please rectifuy if any problem found ?

    You may want to change:
    check lt_st_p1 is not INITIAL.
    to
    check lt_st_p1[] is not INITIAL.
    This depends on whether or not the internal table was defined with a header line.
    Rob
    Edited by: Rob Burbank on Jan 2, 2012 2:45 PM

Maybe you are looking for