Order by results in duplicates rows returned

Hi All,
Just got the following question that I could not understand at all. Let's assume we have a query like this:
select d.d_name, e.e_name
from dept d, emp e
where d.d_id = e.d_id
And this query returns 3 rows only:
IT JOHN
IT JAMES
ADMIN BILL
It was found that if the query was changed as:
select d.d_name, e.e_name
from dept d, emp e
where d.d_id = e.d_id
ORDER BY d.d_name, d.e_name
sometimes it returns as 4 rows instead of 3:
ADMIN BILL
IT JAMES
IT JAMES
IT JOHN
How this be possible?
This happened sometimes on windows platform.

Hi All,
Just got the following question that I could not understand at all. Let's assume we have a query like this:
select d.d_name, e.e_name
from dept d, emp e
where d.d_id = e.d_id
And this query returns 3 rows only:
IT JOHN
IT JAMES
ADMIN BILL
It was found that if the query was changed as:
select d.d_name, e.e_name
from dept d, emp e
where d.d_id = e.d_id
ORDER BY d.d_name, d.e_name
sometimes it returns as 4 rows instead of 3:
ADMIN BILL
IT JAMES
IT JAMES
IT JOHN
How this be possible?
This happened sometimes on windows platform.

Similar Messages

  • Extended VO results in duplicate rows

    Hi,
    I have entended a VO and added one more field to the VO query. But now that VO is displaying duplicate rows. I executed same query from sql plus but there it is returning unique rows. What can be the reason? Is there something I had missed while extending VO.
    Thanks in advance.
    Hitesh

    Hitesh,
    How exactly did you do the extension and applied it?
    Put some debugging code to print the query and row counts and recheck.
    --Shiv                                                                                                                                                                                                                                                                                                       

  • Duplicate rows returned by contex index

    Hi
    I have a context index - locally partitioned with concatenated datastore.
    When I run a query on this it gives me duplicate rows (But for some rare cases only).
    Is this a bug in Oracle text?
    The table is partitioned on column norm_state_query - This query gives a duplicate -
    select rowid
    from mv_borrower_branch_details
    where contains ( norm_state_query, '( ( (fuzzy(${TATA},60,20,n) OR fuzzy(${PGIMENTS},60,20,n) OR fuzzy(${TATAPGIMENTS},60,20,n)) within norm_concat_name ) ) and ( ( ({43} OR fuzzy(${CHOWRINGHEE},60,20,n) ) within norm_concat_address ) )', 1 ) > 0
    and norm_state_query = 'WEST BENGAL'
    AAAKOGAAPAAAETMAAQ
    AAAKOGAAPAAAETMAAQ
    Thanks and regards
    Pratap

    Have you changed the partition definitions since you first created the index?
    Maybe that could cause the problem.
    Otherwise, it does sound like a bug. Please contact support so they can work
    through it with you.

  • How to update duplicate row from table

    Hi,
    how to update duplicate row from table?
    First to find duplicate row then update duplicate row with no to that duplicate row in oracle.
    can you give me suggestion on it?
    Thanks in advance.
    your early response is appreciated...

    In order to find a duplicate row, see:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1224636375004
    (or search this forum, your question has been asked before)
    In order to update it, just create and use an Oracle sequence, have it start and increment at a value that doesn't exist in your table.
    If that doesn't get you going, post some CREATE TABLE + INSERT INTO statements, and the results you want from them, in other words: a complete testcase.

  • Wierd duplicate rows problem

    Hi,
    I've a partitioned table and when I query to extract primary keys for a particular month, I'm getting wierd results. Here is what is happening -
    SELECT colA, colB, colC
    FROM tableA partition(Y06M01)
    WHERE current = 'Y'
    -- This query is returning me some duplicate rows for colA, colB, colC when these columns form primary key on tableA. Note that, rowids for these rows are not repeating, which makes me think oracle is actually storing these duplicate rows on the drive.
    Now, for the values that are repeating in the above query, following query doesnt result in duplicate rows (note that I'm not mentioning partition name in the from clause) -
    SELECT colA, colB, colC
    FROM tableA
    WHERE current = 'Y'
    AND (
    (colA = <val1> AND colB = <val2> AND colC = <val3>)
    OR
    (colA = <val4> AND colB = <val5> AND colC = <val6>)
    OR
    (colA = <val7> AND colB = <val8> AND colC = <val9>)
    Does anyone know why such a thing is happening? is it some kind of internal oracle error?
    Thanks

    Answers to your questions
    FROM tableA partition(Y06M01)Why have you need to query against the partition instead of table level ?
    -- There's no need, but the rows that are repeating lie in this partition. Hence, querying against the partition or against the table should return same results.
    colA, colB, colC when these columns form primary key on tableAAre they a primary key created ?
    -- Yes there's is a primary key created on these columns.
    Anyway, have you just some example output to show us.
    -- Here is the sample output:
    Scenario I (If I query against the partition). In this case if i extract rowids, they are different for each of below selected 6 rows
    colA colB colC
    1 2 3
    4 5 6
    4 5 6
    4 5 6
    7 8 9
    7 8 9
    Scenario II (If I query against the table for values (1,2,3), (4,5,6) and (7,8,9))
    colA colB colC
    1 2 3
    4 5 6
    7 8 9
    Furthermore, generally, to see the duplicate rows, try this query :
    select colA, colB, colC, count(*)
    from tableA
    having count(*)>1;
    -- I did run this query and again if I query against the partition I see duplicate rows and when I query against the table there are no duplicate rows.

  • In what order are results from gather_database_stats 'LIST AUTO' returned?

    11.2.0.1.0. The results from the following seem to have some order to them (groupings of objects returned alphabetically). Didn't see anywhere in the docs to indicate what's getting returned in what order (empty stats, stale stats). I looked at table stats for one at the top of the list and it looks like the table had stats gathered recently, so i'm confused. I ran this from sqlplus:
    set serveroutput on size unlimited;
    DECLARE
    ObjList dbms_stats.ObjectTab;
    BEGIN
    dbms_stats.gather_database_stats(objlist=>ObjList, options=>'LIST AUTO');
    FOR i in ObjList.FIRST..ObjList.LAST
    LOOP
    dbms_output.put_line(ObjList(i).ownname || '.' || ObjList(i).ObjName || ' ' || ObjList(i).ObjType || ' ' || ObjList(i).partname);
    END LOOP;
    END;
    /

    Enlightened answer: "So bug off and work with what you get"
    The report was run on a database that doesnt have any auto stat collection occurring. There are 4000 items returned in the list. One of the items looks ok when you look at dba_tables (row count correct and last_analyzed recent). Just trying to figure out why this table was included in the list. Might be the way stats collected for it isn't updating some mechanism that gather_database_stats is utilizing. From what I can tell the order is 1) tables with no stats, 2) indexes with no stats, 3) stale tables.

  • Returning Duplicate Rows

    Hi. I'm working on this query, and I'm having problems. When I add an inner join, I start getting multiple rows returned.
    What I want returned is ONLY the first row below, but I'm instead getting both rows (which are identical).
    SALESMAN_NO | CUSTOMER_NO | ORDER | SALES | COGS | MARGIN
    97 | 1306969000 | 00477023 | 517.40 | 298.20 | 219.18
    97 | 1306969000 | 00477023 | 517.40 | 298.20 | 219.18
    Here's my query. And when I add the inner joins, I get the 2nd row above. If I run the SAME query without the inner joins, I get the 1 and only 1 row - which is what I'm trying to get to. Getting this 2nd row is screwing up the SUM functions I'm ultimately trying to use.
    SELECT
    SOE.SALESMAN_NO AS [SALESMAN],
    SOE.CUSTOMER_NO AS [CUSTOMER #],
    (SOE.SALE_ORDER_NO) AS [ORDERS],
    (SOE.SALES_AMT/100) AS [SALES],
    (SOE.COST_GOODS_SOLD/100) AS [COGS],
    ((SOE.SALES_AMT/100) - (SOE.COST_GOODS_SOLD/100)) AS [MARGIN]
    FROM
    SOE_HEADER SOE
    INNER JOIN CUST_NAME CUST
    ON SOE.CUSTOMER_NO = CUST.CUSTOMER_NO
    INNER JOIN OUTSIDE_SALES OUTSIDE
    ON CUST.SALESMAN_NO = OUTSIDE.SALESMAN_NO
    WHERE
    SOE.SALESMAN_NO <> '83'
    AND SOE.TYPE_OF_ORDER = '00'
    AND SOE.ORDERS_STATUS = '06'
    AND SOE.DATE_OF_ORDER > 20080101
    AND SOE.TYPE_OF_FRGHT IN ('13','14')
    AND SOE.CUSTOMER_NO = '1306969000'
    I've looked at the data and at this query for about an hour now, and need some help. Thanks.

    If you want to get the distinct rows only in this SELECT then you may use DISTINCT. ie replace the table with a query
    ,(Select Distinct SALESMAN_NO,CUSTOMER_NO, ORDER  SALES ,COGS , MARGIN From YourTableName) AS AliasName
    Check this too
    Find and/or Delete Duplicate Rows
    http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=DuplicateRows&referringTitle=Home
    Madhu
    SQL Server Blog
    SQL Server 2008 Blog

  • Crystal report returning duplicate rows - Linking issue?

    Hello,
    I know this is a commonly brought up issue - that duplicate rows are returned in Crystal reports for various reasons.  In a lot of instances, where it's only a single row of data per case that I'm looking for, I'll move them to their own group.  But that solution doesn't work here.
    The tables and links used in the simple report I have are illustrated in the attached "Report Database Expert Links.jpg" file, and the conditions and report fields required as as follows:
    Select Expert conditions:
    {CLAIM_PERIODS.CPE_START_DATE} < Today and
    {CLAIM_PERIODS.CPE_END_DATE} > Today and
    {CLAIM_ROLES.CRO_START_DATE} < Today and
    IsNull({CLAIM_ROLES.CRO_END_DATE})
    Report Design fields (in Details section):
    CLAIMS.CLA_REFNO, CLAIM_ROLES.CRT_CODE, PARTIES.PAR_PER_FORENAME, PARTIES.PAR_PER_SURNAME
    So what this report is to do:
    It looks for benefit claims which are live (have a CLAIM_PERIODS.CPE_START_DATE prior to today, and CLAIM_PERIODS.CPE_END_DATE after today), and for these claims gives a breakdown of all people in the household (everyone associated with that claim, where CLAIM_ROLES.START DATE is prior to today, and end date is null - to pick out those who are currently active in the household).
    This works fine otherwise, but the issue is that each live claim can have either one or two rows present in CLAIM_PARTS and CLAIM_PERIODS (so could satisfy my first two conditions twice).  For claims with only a single claim part active, I get each household member listed once.  But when they have two claim parts active, I get eveyone listed twice.
    Is there a way - either in how I'm linking the tables up, or how I'm arranging the report design, that I can have every household member only appear once no matter how many related rows there are in CLAIM_PARTS and CLAIM_PERIODS?
    Many thanks in advance,
    Sami
    P.S. I don't seem to be allowed to attache image files to my post, but have embedded the content instead:

    Thank you very much Don - this is a feature I wasn't aware of previously, and is a big step in the right direction for me.  Really useful.
    In the report mentioned, this sort of works.  It works very well on individual fields - so I could just "Suppress If Duplicated" on the forename and then remove duplicates on that column when exported to Excel (or simply bring in a unique field such as the party reference number and do likewise).
    However, is there a way to get Crystal to do this for me?  So to suppress the whole line based on whether or not I'm suppressing this one field?
    Just applying "Suppress If Duplicated" to all fields at once seems to have slightly unpredictable behaviour - not suppressing every field in the row.  So I experimented a bit with using the "Suppress" tick to do this, then applying a formula to it.  But the closest I can get for the formula is something like:
    -     {PARTIES.PAR_PER_FORENAME} = previous({PARTIES.PAR_PER_FORENAME}) and
    {PARTIES.PAR_PER_SURNAME} = previous({PARTIES.PAR_PER_SURNAME}) and
    Which will only compare the current row with previous.  Is there a way to do the same comparison but with all previous rows?

  • Report Builder 2.0 returning duplicate rows in query designer

    Hi,
    I have a query running off a model, when I explore the data in the model and in a standard sql table it returns one row for each record, which include a unique id for each which is correct.
    When I go into report builder query designer, it shows duplicate rows for each record. I have removed and added fields to try and pin point why and the only reason i can come up with is that it runs fine until I add in a field thats varchar(255) or
    varchar(max). This is when it starts to duplicate the records.
    Can anyone tell me why it does this or point me in the direction of how to stop this. I can't edit the query in text to add DISTINCT so thats not an option.
    Many thanks,
    JJSJ

    OK - I have found a partial answer.   By Googling Report Builder and VARCHAR, I found another post which reported problems with the semantic query builder when the underlying table/view was returning columns of type VARCHAR(MAX).   
    On looking at the length setting for the data column in the DSV,  this reported a length of 2,147,483,647 for this field.   This is very odd because on querying the underlying table the largest length that I can find for this column is 191,086
    (which is far larger than I would have expected - I am investigating this separately).
    However, why should the Report Model think that this field contains such a large value?
    Anyway,  the other post that I found reported that they had solved their problem by converting the field to a VARCHAR (255).    I tried this (by casting the column in my View to VARCHAR(255))  and this resolved the problem
    - no more duplicate rows when adding this field to the query!!!
    I also tried CASTING to TEXT and to VARCHAR(8000).  The former did not resolve the problem; the latter did.
    So I have a workaround but I don't understand why.  
    Can anybody explain why having a VARCHAR(max) column in my entity causes duplicate rows.    
    I suspect it is to do with the fact that for some reason the Report Model seems to think that there is an exceptionally long text string stored in this column in one of the rows but that again is a puzzle.
    Thanks
    Richard

  • Returning duplicate rows only

    Hi All,
    I need a Query to get only duplicate rows from a table. It should print the duplicate rows the number of times .
    it exists in the table.

    Added some duplicate records in emp table
    select count(*),empno,ename,job,mgr,hiredate,deptno from emp group by empno,ename,job,mgr,hiredate,deptno
      COUNT(*)  EMPNO ENAME      JOB              MGR HIREDATE      DEPTNO
         2       7782 CLARK      MANAGER         7839 09-JUN-81         10
         5       7844 TURNER     SALESMAN        7698 08-SEP-81         30
         3       7698 BLAKE      MANAGER         7839 01-MAY-81         30
         1       7900 JAMES      CLERK           7698 03-DEC-81         30
         1       7654 MARTIN     SALESMAN        7698 28-SEP-81         30
         1       7788 SCOTT      ANALYST         7566 19-APR-87         20
         1       7566 JONES      MANAGER         7839 02-APR-81         20
         6       7521 WARD       SALESMAN        7698 22-FEB-81         30
         5       7369 SMITH      CLERK           7902 17-DEC-80         20
         4       7934 MILLER     CLERK           7782 23-JAN-82         10
         1       7499 ALLEN      SALESMAN        7698 20-FEB-81         30Count(*)>1 are having duplicates
    Filter this with condition Count(*)>1
    select count(*),empno,ename,job,mgr,hiredate,deptno from emp group by empno,ename,job,mgr,hiredate,deptno having count(*)>1
      COUNT(*)  EMPNO ENAME      JOB              MGR HIREDATE      DEPTNO
         2       7782 CLARK      MANAGER         7839 09-JUN-81         10
         5       7844 TURNER     SALESMAN        7698 08-SEP-81         30
         3       7698 BLAKE      MANAGER         7839 01-MAY-81         30
         6       7521 WARD       SALESMAN        7698 22-FEB-81         30
         5       7369 SMITH      CLERK           7902 17-DEC-80         20
         4       7934 MILLER     CLERK           7782 23-JAN-82         10Edited by: Lokanath Giri on २४ जनवरी, २०१२ १०:४६ पूर्वाह्न

  • Duplicate rows in 5 table

    I have five tables(A,B,C,D,E), and I am trying to check for duplicate rows in all the tables, I tried using inner join, but the first three join did not return any table. is there another way.the tables only have two columns , the email(different values)
    and authour (which is the same person in the table)
    when i tried 
    select * from TABLE A
    INNER JOIN TABLE B
    ON TABLEA. EMAIL = TABLEB.EMAIL
    INNER JOIN TABLEC
    ON TABLEA.EMAIL=TABLEC.EMAIL
    it came back with no result, the other way I am thinking is to unioun all all the tables and try to use count and group by ,but this will only show me the duplicates and not the authours
    please any other way

    it came back with no result, the other way I am thinking is to unioun all all the tables and try to use count and group by (but I could not insert my result in a new table)
    please any other way
    I dont understand your point here...Are you trying the below?
    Create Table T1(name varchar(50),Email Varchar(50))
    Insert into T1 Values('SQL','[email protected]'),('.NET','[email protected]')
    Create Table T2(name varchar(50),Email Varchar(50))
    Insert into T2 Values('Server','[email protected]'),('BizTalk','[email protected]')
    Create Table T3(name varchar(50),Email Varchar(50))
    Insert into T2 Values('Sql','[email protected]'),('server','[email protected]')
    ;With cte as
    (Select * From T1
    Union All
    Select * From T2
    Union All
    Select * From T3)
    Select name,email, count(1) From cte Group by name , email having count(1)>1
    Drop table T1,T2,T3
    I was able to insert the union product in a table, and i used this 
    SELECT EMAIL,AUTHOR,COUNT(EMAIL) AS AMOUNT FROM ALLEMAIL
     GROUP BY AUTHOR,EMAIL
     ORDER BY  AMOUNT DESC, email desc
    but its showing the email and the count but its appearing like the duplicate is only associated with one authour

  • How to restrict number of rows returned in a query

    Hi frnds,
    I'd like to restrict number of rows returned by my query to some 10 rows. how to do that.When I try doing with the rownum<10 its giving results for a particular dept and that too some 6 rows only...btw I'm grouping my table and includes joins from many a table and am ordering the table results by a column.. How to do this..

    776317 wrote:
    Hi frnds,
    I'd like to restrict number of rows returned by my query to some 10 rows. how to do that.When I try doing with the rownum<10 its giving results for a particular dept and that too some 6 rows only...btw I'm grouping my table and includes joins from many a table and am ordering the table results by a column.. How to do this..
    TELL ME HOW MANY ROWS YOU HAVE IN TABLE?
    Because you have only *6 rows* in you column, if you less than 10 rows then it displays only containied/exist rows. nothing much
    select ename,empno from emp where rownum < 10;Thanks

  • How to delete duplicate row in certain case

    Hi all,</p>
    <p>I need you help to delete my duplicate row.</p>
    <p>Sample Data in table (<b>table1</b>)</p>
    <p style="margin-top: 0; margin-bottom: 0"> </p>
    <p style="margin-top: 0; margin-bottom: 0"><b>Timein       
    DateIn           
    locationin        useridin       
    status</b></p>
    <p style="margin-top: 0; margin-bottom: 0">08:20:00    01/09/2007       
    0001               
    U01               
    1</p>
    <p style="margin-top: 0; margin-bottom: 0">08:10:30    01/09/2007       
    0004               
    U01               
    1</p>
    <p style="margin-top: 0; margin-bottom: 0">07:20:00    01/09/2007       
    0006               
    U01               
    1</p>
    <p style="margin-top: 0; margin-bottom: 0">08:14:00    01/09/2007       
    0001               
    U02               
    1</p>
    <p style="margin-top: 0; margin-bottom: 0">06:10:30    01/09/2007       
    0004               
    U02               
    1</p>
    <p style="margin-top: 0; margin-bottom: 0">08:10:10    01/09/2007       
    0006               
    U02               
    1</p>
    <p> </p>
    <p>I need to delete the row in table1 and leave the minimum <b>timein</b> in
    that table by <b>useridin</b>.</p>
    <p>The last output in table1 is like below.</p>
    <p style="margin-top: 0; margin-bottom: 0"><b>Timein       
    DateIn           
    locationin        useridin       
    status</b></p>
    <p style="margin-top: 0; margin-bottom: 0">07:20:00    01/09/2007       
    0006               
    U01               
    1</p>
    <p style="margin-top: 0; margin-bottom: 0">06:10:30    01/09/2007       
    0004               
    U02               
    1</p>
    <p>Can i used below  sql to output the result;</p>
    <font FACE="Courier" SIZE="2">
    <p style="margin-top: 0; margin-bottom: 0"></font>
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">delete</font><font FACE="Courier" SIZE="2">
    </font><font FACE="Courier" SIZE="2" COLOR="#0000ff">from</font><font FACE="Courier" SIZE="2">
    <font color="#808000">table1</font> t1 </font>
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">where</font><font FACE="Courier" SIZE="2">
    t1</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font><font FACE="Courier" SIZE="2" COLOR="#ff0000">rowid</font><font FACE="Courier" SIZE="2">
    </font><font FACE="Courier" SIZE="2" COLOR="#0000ff">&gt;</p>
    </font><font FACE="Courier" SIZE="2">
    <p style="margin-top: 0; margin-bottom: 0"></font>
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">(</font><font FACE="Courier" SIZE="2">
    </font><font FACE="Courier" SIZE="2" COLOR="#0000ff">select</font><font FACE="Courier" SIZE="2">
    </font><font FACE="Courier" SIZE="2" COLOR="#0000ff">min(</font><font FACE="Courier" SIZE="2">t2</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font><font FACE="Courier" SIZE="2" COLOR="#ff0000">rowID</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">)</font><font FACE="Courier" SIZE="2">
    </font><font FACE="Courier" SIZE="2" COLOR="#0000ff">from</font><font FACE="Courier" SIZE="2">
    <font color="#808000">table1</font> t2</p>
    <p style="margin-top: 0; margin-bottom: 0"></font>
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">where</font><font FACE="Courier" SIZE="2">
    t1</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font><font face="Courier" size="2">Datein
    = t2.Datein</font></p>
    <font FACE="Courier" SIZE="2">
    <p style="margin-top: 0; margin-bottom: 0"></font>
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">and</font><font FACE="Courier" SIZE="2">
    t1</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font><font FACE="Courier" SIZE="2">Status
    </font><font FACE="Courier" SIZE="2" COLOR="#0000ff">=</font><font FACE="Courier" SIZE="2">
    t2</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font><font FACE="Courier" SIZE="2">Status</font></p>
    <p style="margin-top: 0; margin-bottom: 0">
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">and</font><font FACE="Courier" SIZE="2">
    t1</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font>UserIdin
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">=</font><font FACE="Courier" SIZE="2">
    t2</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font>UserIdin
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">order by t2.timein);</font></p>
    <p style="margin-top: 0; margin-bottom: 0"> </p>
    <p style="margin-top: 0; margin-bottom: 0"><font face="Courier" size="2">Thanks
    in advanced

    Hi Rob,
    Just trying to chip in little bit!
    Created Table As follows same as you, only two rows with duplicatem user, datein, and timein:
    create table table1
    as
    select '08:20:00' timein, date '2007-09-01' datein, '0001' locationin, 'U01' useridin, 1 status from dual union all
    select '08:10:30', date '2007-09-01', '0004', 'U01', 1 from dual union all
    select '07:20:00', date '2007-09-01', '0006', 'U01', 1 from dual union all
    select '08:14:00', date '2007-09-01', '0001', 'U02', 1 from dual union all
    select '06:10:30', date '2007-09-01', '0004', 'U02', 1 from dual union all
    select '06:10:30', date '2007-09-01', '0001', 'U02', 1 from dual
    If I run your delete statement result row will be as follows:
    SQL> select * from table1;
    TIMEIN DATEIN LOCA USE STATUS
    07:20:00 01-SEP-07 0006 U01 1
    06:10:30 01-SEP-07 0004 U02 1
    06:10:30 01-SEP-07 0001 U02 1
    Here problem is that its not able to delete duplicate rows having same timein and timeout.
    So I changed you query as follows:
    DELETE FROM tab1
    WHERE rowid NOT IN (
         SELECT     MIN(rowid)
         FROM     tab1
         WHERE     (UseridIn, TO_DATE(TO_CHAR(DateIn,'YYYYMMDD') || TimeIn,'YYYYMMDDHH24:MI:SS')) IN
              (     SELECT     UseridIn, MIN(TO_DATE(TO_CHAR(DateIn,'YYYYMMDD') || timein,'YYYYMMDDHH24:MI:SS'))
                   FROM     tab1
                   GROUP BY UseridIn)
         GROUP BY UseridIn
    If I run your delete statement with little bit of changes, the result row was as follows:
    SQL> select * from table1;
    TIMEIN DATEIN LOCA USE STATUS
    07:20:00 01-SEP-07 0006 U01 1
    06:10:30 01-SEP-07 0004 U02 1
    Regards,
    Raj

  • SQL Server 2014 - Delete duplicate rows in a table except one

    Hi all,
    I have a table that contains duplicate rows. Using grouping I can easily identify those rows.
    As of now, I count the grouped records and copy one of the group in a temporary table together with its count of elements. Than I loop over this table and delete N - 1 rows of each group from the original table. Unfortunately this is done with two cursors
    and WHILE loops.
    Is anybody out there who could give some hints how to handle deletion of duplicated rows leaving one in place using pure SQL? I tried a full delete of all elements of a group and then an INSERT of one row to recreate a row again. But this is not
    very elegant and close to using cursors.
    Regards Uwe

    Hi all,
    based on input below from Uri, I have developed a little more general solution for removal of duplicates. I did that, because I'm sure that for many beginners in SQL it is easier specialize a proposal by removing parts of it than adding new functionality.
    Here is my code.
    -- Remove duplicates from a table and document the deleted rows
    DECLARE @MyTable Table (Col1 int, Col2 int, Col3 int, Col4 int);
    DECLARE @OutTable Table (Col1 int, Col2 int, Col3 int, Col4 int);
    INSERT INTO @MyTable VALUES
    (1, 10, 100, 7),
    (2, 20, 200, 2),
    (2, 20, 200, 1),
    (3, 30, 300, 3),
    (1, 10, 200, 4),
    (1, 10, 100, 5),
    (1, 10, 100, 6);
    WITH cte (RN, Col1, Col2, Col3, Col4)
    AS (SELECT ROW_NUMBER() OVER (PARTITION BY Col1, Col2, Col3 ORDER BY (SELECT 0)) AS RN, Col1, Col2, Col3, Col4
    FROM @MyTable)
    DELETE FROM cte
    OUTPUT DELETED.Col1, DELETED.Col2, DELETED.Col3, DELETED.Col4
    INTO @OutTable (Col1, Col2, Col3, Col4)
    WHERE RN > 1;
    SELECT * FROM @OutTable;
    And this is the result:
    The MS 139444 article Satish mentioned is focussed on duplicate PKs removal. Thanks for the hint.
    Thanks to you all for your rapid response.
    Regards Uwe

  • Duplicate rows showing up in a table on the UI

    Hi All,
    We have a VO that returns 6 rows in a table on the UI. The rows become editable when a checkbox(a column in the table) is selected.
    On running it, sometimes we are getting 12 rows on the UI such that the first 6 rows are shown again in the table in the same order.
    When changes are made to this table and saved, only 6 rows are saved in the database table. Also, if 1 row is selected and the duplicate row of this row is not selected, then if we go to some other page and come back, the row that was selected earlier, will be unselected. If both the rows of same values are selected, only then the changes will be saved.
    The VO query has 2 tables. Checked data in both of these tables and executed the query too, but did not find any data issue. Also, we are having an order by clause in the query and the data in the table is not showing up in order.
    This is not occurring consistently but occurring for long durations.
    Can anybody fix this?
    Thanks,
    Sakshi

    Do you still have the "Music Video" Smart Playlist in iTunes? If you right click on a video file, which normally shows up under "Movies" you can pick the video type of Movie, Music Video, or TV Show. When you select "Music Video" the video file drops out of the Movies section and if the Music Video playlist is present will show up there.
    You might have deleted that playlist so it wouldn't be on the iPod either.
    So create a Smart Playlist where the rule is Video Kind IS Music Video...
    Patrick

Maybe you are looking for

  • Free Automatic Duck .AAF export plug-in not compatible w/After Effects 6.5?

    Greetings, There is a free export/import module for FCP that Automatic Duck produces for Apple that lets you export your time line as an AAF sequence. As most of you know, the AAF sequence can be imported in to After Effects and other programs that s

  • How do I get my apps and pics off my 3gs to my 4

    just upgraded to the apple 4, but have photos on the 3 GS and some apps too that I really don't want to lose...can someone tell me how I can get the stuff off the old iphone and onto the new one?

  • Cant Get it to connect

    I Hook up my ipod to the comp. and then it says do not disconnect but it doesnt come up on my iTunes menu so i cant add song. and also then when i unplug the ipod its charged but it says connect to iTunes to restore but it wont commect so Please Help

  • Mapping shipment 05 idoc

    hi experts,                  we have a scenario to map shipment 05 idoc to delivery 05 idoc. there will be one or more handling units in source idoc.for every handling unit in shipment 05 we should map respective article information to seperate deliv

  • I.D Questions

    Hi, I have doubt in 1.Party 2.Service without Party 3.Business System 4.Business Service When we will use Party and when we will use Service without Party? When we will use Business System and When we will use Business Service? Thanks Seshu