SAP query returning duplicate records

Hi all,
I'll try to elaborate as much as possible so here goes:
I have a query that I am trying to run in SAP B1 8.8 which is not returning the true set of results I am expecting.
Essentially I am trying to filter by product based on delivery notes. I have the query as follows -
SELECT count(*), sum(T0.[DocTotal]-T0.[VatSum]) as "Order Value"
FROM ODLN T0  INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode
WHERE DateName(mm,T0.DocDate) = 'November'
and DateName(yyyy,T0.DocDate) = '2011'
and (T1.[GroupCode] = '102' or T1.[GroupCode] = '107')
This returns the correct result of 1320 row numbers and the given sum.
When I try to break this query down further by product using the query below, the values are doubled, tripled, quadrupled etc and summed up to give a number that is extremely high.
The code is as follows:
SELECT distinct count (*), sum(distinct T0.[DocTotal]-T0.[VatSum]) as "Order Value" from DLN1 T1
inner join ODLN T0 on T0.DocEntry = T1.DocEntry
Inner join OITM T2 on T2.ItemCode = T1.ItemCode
inner join OCRD T3 on T0.CardCode = T3.CardCode
WHERE DateName(mm,T0.DocDate) = 'November'
and DateName(yyyy,T0.DocDate) = '2011'
and (T3.[GroupCode] = '102' or T3.[GroupCode] = '107')
and (T2.[ItmsGrpCod] = '108' or T2.[ItmsGrpCod] = '112' or T2.[ItmsGrpCod] = '115')
This also returns 1819 rows where there should be less based on the product.
Please let me know if I am not explaining myself well or need further clarification.
Thanks!

hi,
try to run this code from your SQL management studio
SELECT     SUM(T0.DocTotal - T0.VatSum) AS [Order Value], T0.DocTotal - T0.VatSum AS [Order Value], T0.DocNum, T0.DocDate, T0.CardCode, T0.CardName, T0.DocTotal,
                      T1.ItemCode, T1.Dscription, T1.Quantity, T2.GroupCode, T3.ItmsGrpCod
FROM         ODLN AS T0 INNER JOIN
                      DLN1 AS T1 ON T0.DocEntry = T1.DocEntry INNER JOIN
                      OCRD AS T2 ON T0.CardCode = T2.CardCode INNER JOIN
                      OITM AS T3 ON T1.ItemCode = T3.ItemCode
GROUP BY T0.DocTotal - T0.VatSum, T0.DocNum, T0.DocDate, T0.CardCode, T0.CardName, T0.DocTotal, T1.ItemCode, T1.Dscription, T1.Quantity, T2.GroupCode,
                      T3.ItmsGrpCod
HAVING      (T2.GroupCode = 102 OR
                      T2.GroupCode = 107) AND (T3.ItmsGrpCod = 108 OR
                      T3.ItmsGrpCod = 112 OR
                      T3.ItmsGrpCod = 115) AND (T0.DocDate BETWEEN CONVERT(DATETIME, '2011-11-01 00:00:00', 102) AND CONVERT(DATETIME, '2011-11-17 00:00:00', 102))
regards,
Fidel

Similar Messages

  • Using Rownum and ROwid returns duplicate records

    Hi All,
    We have implemented pagination as below using rowid and rownum
    SELECT
    id
    FROM
    emp
    WHERE
    ROWID IN
    SELECT RID FROM (SELECT
    ROWID RID,
    ROWNUM RNUM
    FROM
    SELECT ID FROM emp
    WHERE
    ((T_ID IN (200005,200229,200230,200249,200250,200049))) AND
    (dte >= sysdate-90) AND
    (LOWER(DESC) = LOWER ('A') AND
    LOWER(NVL(FLAG,'0')) != LOWER ('3') AND
    LOWER(MODDE) like LOWER ('%210%')) ORDER BY dte ASC ))
    WHERE ROWNUM < 11) WHERE RNUM>= 1)) ORDER BY dte emp.ASC
    But, we face that - the query inserts duplicate records in consecutive pages. For Eg:
    1.if a,b,c,d,e - is returned for first iteration, then for the next iteration - f,g,h,a,y is returned.
    Is it because that the Order by clause doesnt have a Unique key column.
    Please help. or suggest how to efficietly implement pagination without performance hit

    try distinct since you are using only one column it will eliminate any duplicates.
    SELECT distinct id
      FROM emp
    WHERE (ROWID IN ( SELECT RID
                         FROM (SELECT ROWID RID,ROWNUM RNUM
                                 FROM (SELECT ID
                                         FROM emp
                                        WHERE ((T_ID IN (200005,200229,200230,200249,200250,200049)))
                                          AND (dte >= sysdate-90)
                                          AND (LOWER(DESC) = LOWER ('A')
                                          AND LOWER(NVL(FLAG,'0')) != LOWER ('3')
                                          AND LOWER(MODDE) like LOWER ('%210%'))
                                       ORDER BY dte ASC ))
                                WHERE ROWNUM < 11) 
                        WHERE RNUM>= 1))
    ORDER BY dte emp.ASC

  • Using index in a query return few records than full table access

    Today we have an issue with a query, when it use the ok index the returned are not all records that apply to where clause condition.
    See bellow
    explain plan for
    select * from movdb.zan_m03 where
    M00AF = TO_DATE('11/01/28','YY/MM/DD') AND
    M00za = 10 AND
    m00AC = 50 AND
    M00AD between 136906 and 136999
    SELECT * FROM TABLE(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 1882720105
    | Id | Operation | Name |
    | 0 | SELECT STATEMENT | |
    | 1 | TABLE ACCESS BY INDEX ROWID| ZAN_M03 |
    |* 2 | INDEX RANGE SCAN | PK_ZAN_M03 |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
    2 - access("M00AF"=TO_DATE('11/01/28','YY/MM/DD') AND "M00ZA"=10 AND
    "M00AC"=50 AND "M00AD">=136906 AND "M00AD"<=137141)
    filter("M00AD"<=137141 AND "M00AD">=136906)
    Note
    - rule based optimizer used (consider using cbo)
    20 rows selected.
    The query above return only one row insted 1579 record that apply to this conditions.
    When forcing a full table acess with a hint, the query return all records that apply, the 1579 record.
    select /*+ FULL(zan_m03) */ M00AF, M00za, m00AC , M00AD from movdb.zan_m03 where
    M00AF = TO_DATE('11/01/28','YY/MM/DD') AND
    M00za = 10 AND
    m00AC = 50 AND
    M00AD between 136906 and 137141
    Can you help me to identify what's happening?
    I am with Oracle 10g R2 10.2.0.4 standard edition
    the statistics are up to date
    the opitimizer_mode are rule, but altering in session level to all_rows happens the same issue.
    Nothing about corruption in the alert log.
    Thanks in advance
    Regards
    Cristiano

    Yes the query are the same and correct restriction for where clause are M00AD between 136906 and 137141.
    I've pasted, by mistake, another test query
    The corrects are:
    select M00AF, M00za, m00AC , M00AD from movdb.zan_m03 where
    M00AF = TO_DATE('11/01/28','YY/MM/DD') AND
    M00za = 10 AND
    m00AC = 50 AND
    M00AD between 136906 and 137141
    This use pk index and return one row
    select /*+ FULL(zan_m03) */ M00AF, M00za, m00AC , M00AD from movdb.zan_m03 where
    M00AF = TO_DATE('11/01/28','YY/MM/DD') AND
    M00za = 10 AND
    m00AC = 50 AND
    M00AD between 136906 and 137141
    This does a full table access and return 1579 records
    I´ve been searching for wrong results bugs on my oracle support, but not found one that mentions something like our issue.
    I checked the dba_tables and dba indexes and the number of rows are different, and I think this would be the same because it's is a pk.
    Look this
    SQL> select NUM_ROWS from dba_tables where table_name = 'ZAN_M03'
    2 /
    NUM_ROWS
    228527878
    select NUM_ROWS from dba_indexes where index_name = 'PK_ZAN_M03';
    SQL> select NUM_ROWS from dba_indexes where index_name = 'PK_ZAN_M03';
    NUM_ROWS
    217510185
    Is normal a index for pk having much fewer rows than table? I think not, but not sure.
    Again
    Thanks in advance
    Regards
    Cristiano

  • Search query returning ALL records

    DW CS3 - MS Access - ASP/VBScript
    I have a search form for records to display on the same page with keywords highlighted.  The search is returning ALL records and highlighting keywords throughout rather than returning specific records with the searched word.  What am I missing?  I'm sure it's something terribly simple.....
              <input name="search" type="text" id="search" value="<%= Request.QueryString("search") %>" />
              SELECT item, item, item, item
              FROM tbl_name
              WHERE item OR item OR item LIKE %MMColParam%
              ORDER BY sql_orderby, Date DESC
              Name: MMColParam
              Type: Text
              Value: Request.Querystring("search")
              Default Value: %

    I was using the word "item" as an example for multiple columns without actually naming them - they are not the same.  I should've used this example:
    SELECT shoes, socks, hats, gloves
    FROM tbl_apparel
    WHERE shoes OR socks OR hats LIKE %MMColParam%
    ORDER BY sql_orderby, Date DESC
    In the past, I had four duplicate query parameters for four columns which worked fine.  But since I only have one search term, I thought I could eliminate three of the duplicate parameters and use just one with the OR statement.
    In the past, you questioned me on this.  You stated, "You only have one search term and so all of the parameters have the same value, but DW still wants to creates 4 parameters. If you were coding this by hand you wouldn't do it that way, but DW's one-size-fits-all code generates four seperate parms. It's nothing to worry about."

  • Query returns zero records in coldfusion context, but works fine in Navicat

    I've got a query that's returning zero records when I load a page.  If I copy and paste that same query (from the debug output) into navicat, I get rows returned (as I expect).  Has anyone seen this?  It happens locally (CF9) AND remotely on our staging server (CF10).  Even weirder, it's a query that was previously working fine - I simply added an if statement to the where clause, and all of a sudden... 
    Here's the query:
            <CFQUERY name="LOCAL.getEncounterServices" datasource="#REQUEST.dsn#"> 
            SELECT
                a.EncounterProductID,
                a.DateTime AS ServiceDate,
                aa.CartItemID,
                aaa.CartID,
                aaaaa.CartStatus,
                b.ProductID,
                b.ProductName,
                b.CPTCode,
                b.Price,
                c.EncounterID,
                c.DateTimeClosed AS EncounterClosedDate,
                d.FirstName,
                d.LastName
            FROM
                EncounterProducts a
                    LEFT JOIN CartItemProduct aa ON (a.EncounterProductID = aa.EncounterProductID AND aa.Active = 1)
                    LEFT JOIN CartItem aaa ON (aa.CartItemID = aaa.CartItemID)
                    LEFT JOIN Cart aaaa ON (aaa.CartID = aaaa.CartID)
                    LEFT JOIN CartStatus aaaaa ON (aaaa.CartStatusID = aaaaa.CartStatusID),
                Product b,
                Encounters c,
                Contacts d,
                EncounterStatuses e
            WHERE
                1 = 1
                AND (aa.CartItemID IS NULL OR aaaaa.CartStatus = 'Deleted')
                AND a.Active = 1
                AND a.ProductID = b.ProductID
                AND a.EncounterID = c.EncounterID
                AND c.PatientID = d.ContactID
                AND c.EncounterStatusID = e.EncounterStatusID
                AND e.EncounterStatus = 'Closed'
              <CFIF IsDefined("ARGUMENTS.encounter") AND IsObject(ARGUMENTS.encounter)>
                     AND c.EncounterID = <CFQUERYPARAM cfsqltype="cf_sql_integer" value="#ARGUMENTS.encounter.getID()#">
             <CFELSE>
                    AND c.DateTimeClosed >= <CFQUERYPARAM cfsqltype="cf_sql_date" value="#ARGUMENTS.startDate#">
                    AND c.DateTimeClosed < <CFQUERYPARAM cfsqltype="cf_sql_date" value="#DateFormat(DateAdd('d', 1, ARGUMENTS.endDate), 'yyyy-mm-dd')# 00:00:00">
               </CFIF>
                AND c.LocationID = <CFQUERYPARAM cfsqltype="cf_sql_integer" value="#ARGUMENTS.locationID#">
                AND c.CustomerID = <CFQUERYPARAM cfsqltype="cf_sql_integer" value="#ARGUMENTS.customerID#">
            </CFQUERY>
    All of this worked just fine before I added the lines:
             <CFIF IsDefined("ARGUMENTS.encounter") AND IsObject(ARGUMENTS.encounter)>
                     AND c.EncounterID = <CFQUERYPARAM cfsqltype="cf_sql_integer" value="#ARGUMENTS.encounter.getID()#">
             <CFELSE>
                    AND c.DateTimeClosed >= <CFQUERYPARAM cfsqltype="cf_sql_date" value="#ARGUMENTS.startDate#">
                    AND c.DateTimeClosed < <CFQUERYPARAM cfsqltype="cf_sql_date" value="#DateFormat(DateAdd('d', 1, ARGUMENTS.endDate), 'yyyy-mm-dd')# 00:00:00">
              </CFIF>
    Previously, it had just been:
                    AND c.DateTimeClosed >= <CFQUERYPARAM cfsqltype="cf_sql_date" value="#ARGUMENTS.startDate#">
                    AND c.DateTimeClosed < <CFQUERYPARAM cfsqltype="cf_sql_date" value="#DateFormat(DateAdd('d', 1, ARGUMENTS.endDate), 'yyyy-mm-dd')# 00:00:00">
    With no IF/ELSE statement.
    Anyone seen anything like this before?  Any ideas? 
    Thanks.

    Right, I'll start disabusing myself of the DateFormat!
    I'm sorry, I should've posted the actual query too.  It's inserting the first part - "AND c.EncounterID = ....."
    Here's the full query:
    LOCAL.getEncounterServices (Datasource=xmddevdb, Time=9ms, Records=0) in /Applications/ColdFusion9/wwwroot/XMD_NEW/xmd_dev/cfc/ShoppingGateway.cfc @ 16:56:28.028
    SELECT
                a.EncounterProductID,
                a.DateTime AS ServiceDate,
                aa.CartItemID,
                aaa.CartID,
                aaaaa.CartStatus,
                b.ProductID,
                b.ProductName,
                b.CPTCode,
                b.Price,
                c.EncounterID,
                c.DateTimeClosed AS EncounterClosedDate,
                d.FirstName,
                d.LastName
            FROM
                EncounterProducts a
                    LEFT JOIN CartItemProduct aa ON (a.EncounterProductID = aa.EncounterProductID AND aa.Active = 1)
                    LEFT JOIN CartItem aaa ON (aa.CartItemID = aaa.CartItemID)
                    LEFT JOIN Cart aaaa ON (aaa.CartID = aaaa.CartID)
                    LEFT JOIN CartStatus aaaaa ON (aaaa.CartStatusID = aaaaa.CartStatusID),
                Product b,
                Encounters c,
                Contacts d,
                EncounterStatuses e
            WHERE
                1 = 1
                AND (aa.CartItemID IS NULL OR aaaaa.CartStatus = 'Deleted')
                AND a.Active = 1
                AND a.ProductID = b.ProductID
                AND a.EncounterID = c.EncounterID
                AND c.PatientID = d.ContactID
                AND c.EncounterStatusID = e.EncounterStatusID
                AND e.EncounterStatus = 'Closed'
                     AND c.EncounterID = ?
                AND c.LocationID = ?
                AND c.CustomerID = ?
    Query Parameter Value(s) -
    Parameter #1(cf_sql_integer) = 28
    Parameter #2(cf_sql_integer) = 16
    Parameter #3(cf_sql_integer) = 6
    Thansk again for the help!

  • How to write ABAP Logic in SAP Query to fetch records from many Tables

    Hi Expert,
    I have one requirement, want to display all BOM (Equipment BOM, Function Location BOM and Meterial BOM) from a particular plant.
    List of tables as below:
    EQST: Equipment to BOM Link
    TPST: Link Between Functional Location and BOM
    MAST: Material to BOM Link
    STPO:BOM item
    Requirement: When user enters Plant then SAP Query should execute and fetch all BOMs (as mentioned above) from STPO Table.
    I have done so far is as follows:
    I create User Group, Infoset and SAP Query.
    While creating INFOSET, i used 4 tables (EQST,TPST,MAST & STPO) and link between then is as follows:
    STPO-STLNR ---> EQST-STLNR : Left Outer Join
    STPO-STLNR ---> TPST-STLNR : Left Outer Join
    STPO-STLNR ---> MAST-STLNR : Left Outer Join
    Now its showing all BOM from all plants though I enter one Plant value.
    Please advise me to write SAP Query and Logic to fetch all BOM from selected Plant Value.
    Thanks,
    Jay.
    Edited by: jaykrishna007 on Jul 29, 2011 11:41 AM

    Hi FCannavo,
    Thanks for your quick reply.
    See, now I changed my Infoset design.
    I added one Plant Table (T001W) and then
    T001W-WERKS--->EQST-WERKS
    T001W-WERKS--->MAST-WERKS
    T001W-WERKS--->TPST-WERKS
    and then
    EQST-STLNR--->STPO-STLNR
    MAST-STLNR--->STPO-STLNR
    TPST-STLNR--->STPO-STLNR
    on selection screen, user will enter Plant Value.
    Now its showing some records, but i dont think so i would be correct output or not, please guide me whether it is correct or not?
    Thanks,
    Jay.

  • Need a query for duplicate records deletion

    here is one scenario...
    23130 ----> 'A'
    23130 ----> 'X'
    23130 ----> 'c'
    These are duplicate records.. when we remove duplicates, the record must get 'c', if it contains A,C,X. If it contains A and X, then the record must get 'X'. That means the priority goes like this C-->X-->A. for this i need query.. this is one scenario. It would be great if u reply me asap.

    Hello
    It's great that you gave examples of your data, but it is quite helpful to supply create table and insert statements too along with a clear example of expected results. Anyway, I think this does what you are looking for.
    CREATE TABLE dt_dup (ID NUMBER, flag VARCHAR2(1))
    INSERT INTO dt_dup VALUES(23130, 'A');
    insert into dt_dup values(23130, 'X');
    insert into dt_dup values(23130, 'C');
    INSERT INTO dt_dup VALUES(23131, 'A');
    INSERT INTO dt_dup VALUES(23131, 'X');
    DELETE
    FROM
      dt_dup
    WHERE
      ROWID IN (  SELECT
                    rid
                  FROM
                    (   SELECT
                          rowid rid,
                          ROW_NUMBER() OVER (PARTITION BY ID ORDER BY CASE
                                                                        WHEN flag = 'A' THEN
                                                                          3
                                                                        WHEN flag = 'X' THEN
                                                                          2
                                                                        WHEN flag = 'C' THEN
                                                                          1
                                                                      END
                                            ) rn
                        FROM
                          dt_dup
                  WHERE
                    rn > 1
    select * from dt_dup;HTH
    David
    Edited by: Bravid on Jun 30, 2011 8:12 AM

  • Query creating duplicate records

    Hi
    I need to create a report that gives the po number, po line item number, material number and the delivery post code.
    I have created a query with the following tables:
    EKKO, EKPO, EBAN, VBEP, VBAK, VBPA, ADRC.
    I have deleted the wrong link between EKKO and EKPO and retained all other links as suggested.
    Could anybody let me know why there are duplicate records in the report pls?
    Thanks
    Desp09

    Desp09 wrote:
    Hi
    >
    > I have connected
    >
    > EKKO-EBELN to EKPO
    >
    >  EKPO -EBELN and EKPO-EBELP  to the same of EBAN
    >
    > also EKPO-BANFN and EKPO-BNFPO to the same of EBAN
    >
    > EBAN-BANFN and EBAN-BNFPO to VBEP
    >
    > VBEP-VBELN to VBAK-VBELn
    >
    > VBAK-VBELN to VBPA-VBELN
    >
    > VBPA-ADRNR to ADRC-ADDRNUMBER.
    >
    > This is the first time I have created a query so if you can kindly explain the logic of the error it would help in my future reports.
    >
    > Thanks
    > Priya
    Hi Priya,
    You can simplify the process if you make use of the LDB, which will fetch the same report with std LDB available in the system.
    You can define multiple infosets and  pull the fields for easier approach.
    Regards
    Shiva

  • How to tune the query for duplicate records while joining the two tables

    hi,i am executing the query which has retrieving multiple tables,in which one of them has duplicate record,how to get single record

    Not enough info...subject says "tune" the query, message says "write" the query...and where is actual query that you had tried ?

  • Af:query : Delete duplicate records from results manually

    Hi
    I have an ADF page with af:quey on a view object.  I have created a viewcriteria to choose few attributes from the view object.
    The view object is created manually using a sql query, where the query has joins to various other tables (it has outer joins too).
    On submit, due to one to many relationship in the joins, i am getting duplicate rows in the results.
    I am currently using 11.1.1.7.0 jDeveloper (We can't upgrade to upper versions due to other constraints of the project).  I thought the property 'Selected in Query = false' on the view object attribute would fix this problem (to eliminate duplicate rows).  But, i guess, 11.1.1.7.0 don't seem to be supporting this option.
    Hence, i was thinking of manually deleting the duplicates from the results of the af:query before displaying it to the user.
    Please let me know, if there is a better way to solve the problem, if not, how can i manually remove duplicates from the resultset before displaying the results.
    I created a new QueryLIstener method to delete the duplicates, by executing the view object, but it retruns all the records without applying the criteria.  May be i am doing something wrong.
    Please suggest the best way.
    Thanks
    Pradeep

    Hi Frank,
    I do have a distinct in my sql but due to 1->M joins i get duplicate rows.  I can avoid it only if i can unselect the attributes in the select.
    I like to display the attributes to the user to choose the criteria (which adds as a predicate to the sql).  But I would like to unselect the 1-M attributes from the results, so i get distinct rows as i have mentioned distinct in the sql.
    Is there a way to restrict duplicate rows ?
    Thanks
    Pradeep

  • URGENT Select Query Returning No Records take same time as that of insert

    Hello Everrybody,
    I am facing a wierd problem...
    I have table with 15 fields and I am selecting a record with some condition...
    for e.g
    select field1,field2,field3....... from tablea where field1=123
    Now I have index on field1
    When I do SQL Trace it show me time taken as
    00:00:00:60 in oracle 817 SQL PLUS
    and using
    oracle 92 sql plus it show as
    00:00:00:01 in oracle 817 SQL PLUS
    Now Query is what does this 60 denotes milliseconds or what in oracle 92 and in oracle 817 sql plus.....
    Also this query does not return any rows...
    When I run the SP that insert records in same table...That sp take about same time as that of select returning no rows......
    Why is ORACLE Taking so much time for that select ????
    Please help.....

    8i measures timings in 100th of a second but I believe that 9i measures stuff in 1000th of a second. However, from your output it looks like SQL*Plus trace is rounding up to the nearest centisecond.
    Time is a very poor way of judging performance when you're talking less than a second per operation. You'd be better off looking at CPU usage and IO activity.
    Anyway, here are some questions for you to research:
    (1) Is field1 a unique index?
    (2) How many rows does this table hold?
    (3) How fresh are the statistics on the table and the index?
    (4) What's the explain plan? What's the TKPROF output?
    (5) Are all of the above the same on both databases?
    Cheers, APC

  • Query returning more records ...

    Hi All,
    I am having a bit issues here. I have three tables and i am trying following query and it is returning 7 rows but I am expecting one row to return -
    >
    select distinct l.olic_id, b.obat_id, l.olic_key
    from op_licences l, op_batches b, op_licence_batches ba
    where BA.OBAT_ID = b.obat_id
    and l.olic_id = ba.olic_id
    and l.olic_key='HQ67138'
    >
    Getting the following result:
    >
    OLIC_ID OBAT_ID OLIC_KEY
    2     3        HQ67138
    2     1468     HQ67138
    2     1469     HQ67138
    2     1470     HQ67138
    2     1471     HQ67138
    2     1472     HQ67138
    2     1473     HQ67138
    7 rows returned in 0.14 seconds
    >
    I also have tried to use outer join and inner join but still does not work. Can any body tell me how can I get one record instead of 7?
    Thanks in advance,
    Regards,
    M Tajuddin

    i am trying following query and it is returning 7 rows but I am expecting one row to returnYou are getting seven different rows so clearly your query is not as selective as it ought to be. Which of those rows is the one you're expecting? Given that, you need to look at the source data and establish the additional criteria you need in order to filter out the other six rows. It looks like OBAT_ID is the troublesome part.
    Given that these are your tables and your business rules there is absolutely no chance that we will be able to solve this for you.
    Cheers, APC
    blog: http://radiofreetooting.blogspot.com

  • Query displaying duplicate records

    I have written a query to display  materials having no purchasing group.
    Can any one plz tell me that why it is displaying duplicate results.
    Thanks
    aprr

    Apprr,
    You have given us no information to help you.
    Please list the Datasource:  Table Join, Direct Read, Logical database, or program.
    Please list any Table or Tables you are using.
    If you are using Table join(s), please list the joined tables and all linking fields.
    Rgds,
    DB49

  • Query returns no records

    Hi
    create table t2(nm date)
    insert into t2 values(sysdate)
    SQL> select * from t2;
    NM
    13-FEB-09
    SQL> select * from t2
      2  where nm=sysdate;
    no rows selectedThough nm column in T2 table is having sysdate as value..
    But the select query says no rows return ..
    Why???
    How to change the query so as to get the result..
    Thanks

    the column nm is also of DATE datatype..
    How can we convert it to date again using to_date function
    SQL> select to_char(nm,'dd-mm-yyyy') from t2;
    TO_CHAR(NM
    13-02-2009the above query is working..
    But
    Select * from t2 where nm=sysdate; is not working..
    How to compare the date columns in where clause
    Edited by: josh1612 on Feb 12, 2009 10:22 PM

  • QUERY - No Duplicate records from 2nd table ???

    Hi Experts,
    I really need help with this. I have 2 tables A and B. See below
    <b>A -
         B</b>
    X -
         XB1
    XB2
    XB3
    Y----
    YB
    Z----
    ZB
    I select a record from A and get its record from B and give it on the output. For entry X I have 3 records in Table B. I want the output to give only 1 record from B for X. It can be any record. How can this be achieved in Query ?
    Is there a special Join ? or can this be achieved by coding in Query ? If so how ?
    I really appreciate your help.
    Thanks !!

    First get the data from table A.
    select * from table (A) into table i_a.
    loop at i_a.
    select single * from table B into table i_b.
    move b reord to final internal table
    append final internal table.
    endloop.

Maybe you are looking for

  • Due date in Detail Aging report

    Dear all, I would like to ask if it is possible to add the Due date for each document displayed in the Detailed Customer Receivable Againg report ? I tried, but it seems impossible to do so, even I set the field as System Variable (as the Due date in

  • Attachments deleted during message mapping in PI 7.1

    We have upgraded our SAP XI 3.0 SP 22 system to SAP PI 7.1 SP06. In XI 3.0 we created some message mappings that mapped an XML payload with attachments to another message type. The attachments would still exist after the mapping step. In SAP PI 7.1 w

  • Using crystal report in V2012?

    When I am using the crystal report viewer and create a new crystal report option will select show me an error message: The system cannot find the file specified:(Exception from HRESULT:0x80070002 )

  • Last 2 characters

    Hi Gurus, I have a requirement to show only those values of an infoobject where, First 2 characters are AB.I have written code for this and is working. Additionally I need to show the values where the last 2 characters are PR. How to write code for t

  • PO Currency different than PIR

    Hi, We recently changed the currency on a PIR but when creating a PO for the material and vendor, it's defaulting to the old currency. The company code currency is still the old currency.  Could that have something to do with it? Thanks ~ Chris