selection of unique records-remove consecutive same data

Hello

I meet a table where in some cases x, y, msg_date_info fields are there... here, data are in large numbers... I need to recover the data in this table under the condition of the query.
SELECT  X longit,Y latit,MSG_DATE_INFO,row_number() over (order by MSG_DATE_INFO asc) SlNo FROM 
(SELECT distinct x,y,MSG_DATE_INFO,row_number() over (order by MSG_DATE_INFO desc) r 
  FROM TRACKING_REPORT WHERE MSISDN='123456789') WHERE R between 1 and 20
It works very well...
Here again one thing I want to add up... this request leads to 20 rows as expected and I want to filter the records so consecutive x and y values of these lines are the same and give only unique values of x and y (provided that the same x and y can be there somewhere in the order of the data).

This example shows what are my needs in detail... and this is the output of the above query
>
80.20550609 13.09469998 8 March 10 19:23:23 1
80.20550609 13.09469998 8 March 10 19:28:37 2
80.20087123 13.09437811 8 March 10 19:33:25 3
80.20550609 13.09469998 8 March 10 19:38:24 4
80.20550609 13.09469998 8 March 10 19:43:25 5
80.20550609 13.09469998 8 March 10 19:48:25 6
80.20087123 13.09437811 8 March 10 19:53:25 7
80.20087123 13.09437811 8 March 10 19:58:24 8
80.20550609 13.09469998 8 March 10 20:03:25 9
80.20087123 13.09437811 8 March 10 20:08:24 10
80.20550609 13.09469998 8 March 10 20:13:24 11
80.20087123 13.09437811 8 March 10 20:18:37 12
80.20550609 13.09469998 8 March 10 20:23:32 13
80.20550609 13.09469998 8 March 10 20:28:25 14
80.20550609 13.09469998 8 March 10 20:33:23 15
80.20550609 13.09469998 8 March 10 20:38:24 16
80.20550609 13.09469998 8 March 10 20:43:24 17
80.20550609 13.09469998 8 March 10 20:48:24 18
80.20550609 13.09469998 8 March 10 20:53:22 19
80.20550609 13.09469998 8 March 10 20:58:24 20

>
This out, I need to filter the unique ROW values x and y and the output should be like

>
80.20550609 13.09469998 03/08/10 19:23 1
80.20087123 13.09437811 03/08/10 19:33 3
80.20550609 13.09469998 03/08/10 19:48 6
80.20087123 13.09437811 03/08/10 19:53 7
80.20550609 13.09469998 03/08/10 20:03 9
80.20087123 13.09437811 03/08/10 20:08 10
80.20550609 13.09469998 03/08/10 20:13 11
80.20087123 13.09437811 03/08/10 20:18 12
80.20550609 13.09469998 03/08/10 20:58 20

>

How to go about this requirement?

Edited by: Aemunathan 9 March 2010 17:45

The following gives the same results on your test data, but perhaps it's more accurate because seeks two changes in x and y:

SQL> with mytab as (
  2  select 80.20550609 x, 13.09469998 y, '08-Mar-10 19:23:23' mydate, 1 rn from dual union
  3  select 80.20550609,13.09469998, '08-Mar-10 19:28:37', 2 from dual union
  4  select 80.20087123,13.09437811, '08-Mar-10 19:33:25', 3 from dual union
  5  select 80.20550609,13.09469998, '08-Mar-10 19:38:24', 4 from dual union
  6  select 80.20550609,13.09469998, '08-Mar-10 19:43:25', 5 from dual union
  7  select 80.20550609, 13.09469998, '08-Mar-10 19:48:25', 6 from dual union
  8  select 80.20087123, 13.09437811, '08-Mar-10 19:53:25', 7 from dual union
  9  select 80.20087123, 13.09437811, '08-Mar-10 19:58:24', 8 from dual union
 10  select 80.20550609, 13.09469998, '08-Mar-10 20:03:25', 9 from dual union
 11  select 80.20087123, 13.09437811, '08-Mar-10 20:08:24', 10 from dual union
 12  select 80.20550609,13.09469998, '08-Mar-10 20:13:24', 11 from dual union
 13  select 80.20087123, 13.09437811, '08-Mar-10 20:18:37', 12 from dual union
 14  select 80.20550609, 13.09469998, '08-Mar-10 20:23:32', 13 from dual union
 15  select 80.20550609, 13.09469998, '08-Mar-10 20:28:25', 14 from dual union
 16  select 80.20550609, 13.09469998, '08-Mar-10 20:33:23', 15 from dual union
 17  select 80.20550609, 13.09469998, '08-Mar-10 20:38:24', 16 from dual union
 18  select 80.20550609, 13.09469998, '08-Mar-10 20:43:24', 17 from dual union
 19  select 80.20550609, 13.09469998, '08-Mar-10 20:48:24', 18 from dual union
 20  select 80.20550609, 13.09469998, '08-Mar-10 20:53:22', 19 from dual union
 21  select 80.20550609, 13.09469998, '08-Mar-10 20:58:24', 20 from dual
 22  )
 23  select x, y, mydate, rn from (
 24  select x, y, mydate, rn, nvl(lead(x) over (order by rn),0) next_x
 25         , nvl(lead(y) over (order by rn),0) next_y
 26  from mytab
 27  ) where next_x != x or next_y != y;

                   X                    Y MYDATE                               RN
-------------------- -------------------- ------------------ --------------------
         80.20550609          13.09469998 08-Mar-10 19:28:37                    2
         80.20087123          13.09437811 08-Mar-10 19:33:25                    3
         80.20550609          13.09469998 08-Mar-10 19:48:25                    6
         80.20087123          13.09437811 08-Mar-10 19:58:24                    8
         80.20550609          13.09469998 08-Mar-10 20:03:25                    9
         80.20087123          13.09437811 08-Mar-10 20:08:24                   10
         80.20550609          13.09469998 08-Mar-10 20:13:24                   11
         80.20087123          13.09437811 08-Mar-10 20:18:37                   12
         80.20550609          13.09469998 08-Mar-10 20:58:24                   20

9 rows selected.

Max
http://oracleitalia.WordPress.com

Tags: Database

Similar Questions

  • Difference in the number of records for the same date - 11 GR 2

    Guy - 11 GR on Windows2005 2, 64-bit.

    BILLING_RECORD_KPN_ESP - is a monthly partitioned table.
    BILLING_RECORD_IDX #DATE - is a local index on "charge_date" in the table above.

    SQL > select / * + index (BILLING_RECORD_KPN_ESP BILLING_RECORD_IDX #DATE) * /.
    2 (trunc (CHARGE_DATE)) CHARGE_DATE;
    3 count (1) Record_count
    4. IN "RATOR_CDR". "" BILLING_RECORD_KPN_ESP ".
    where the 5 CHARGE_DATE = January 20, 2013.
    Group 6 by trunc (CHARGE_DATE)
    5 m

    CHARGE_DATE RECORD_COUNT
    ------------------ ------------
    2401 20 January 13-> > some records here.

    -> > Here I can see only '2041' records for Jan/20. But in the query below, it shows "192610" for the same date.

    Why is this difference in the number of records?

    SQL > select / * + index (BILLING_RECORD_KPN_ESP BILLING_RECORD_IDX #DATE) * /.
    (trunc (CHARGE_DATE)) CHARGE_DATE,
    2 count (1) Record_count
    3. FOR "RATOR_CDR." "" BILLING_RECORD_KPN_ESP ".
    "4 where CHARGE_DATE > 20 January 2013."
    Group of 5 by trunc (CHARGE_DATE)
    6 order by trunc (CHARGE_DATE)
    5 m

    CHARGE_DATE RECORD_COUNT
    ------------------ ------------
    192610 20 January 13-> > more records here
    JANUARY 21, 13 463067
    JANUARY 22, 13 520041
    23 JANUARY 13 451212
    JANUARY 24, 13 463273
    JANUARY 25, 13 403276
    JANUARY 26, 13 112077
    27 JANUARY 13 10478
    28 JANUARY 13 39158

    Thank you!

    Because in the second example you also select rows that have a nonzero component.

    The first example selects only rows that are 00:00:00

    (by the way, you should ask questions like this in the forum SQL)

  • DTS moves to the same data store

    Greetings,

    We are short v5.5u1 esxi and vcenter device with DTS clusters installation using thresholds to space only at this time. We do not limit our VM to place records on the same data and store, and in view of the virtual machine can have his records scattered across data warehouses in a cluster of the DS.

    We have many events that seem to do nothing is represented below.  Everyone agrees that something actually happens or vcenter turns his wheels?

    Thank you

    Ron

    Just answered my own question... it has to do with my scattered placement of vmdk. Since the vmx file lives on a given data store, the event shows that the activity... However if you check the DTS tab for the cluster data store you will find the disks associated with the virtual machine on other data warehouses were actually moved.

  • unique several record based on the date record selection

    Hi experts,

    I have a table that contains multiple records for unique identification number now, I select the single record that contains the most recent date.

    Here is the structure

    Name of Type Null

    ------ ---- ------------

    NUMBER OF ID_P

    NAME_P VARCHAR2 (12)

    DATE_P TIMESTAMP (6)

    Reviews

    ---------------------

    1 loosi 22 August 13 01.27.48.000000000 PM

    1 hahahaha August 26, 13 01.28.10.000000000 PM

    KK 2 22 August 13 01.28.26.000000000 PM

    Emmeline 2 26 August 13 01.28.42.000000000 PM

    now I have to select below 2 lines how to write select qurie for this?

    1 loosi 26 August 13 01.27.48.000000000 PM

    Emmeline 2 26 August 13 01.28.42.000000000 PM

    Hello

    You can use the ROW_NUMBER analytic function.

    I don't have a copy of your table, so I'll use scott.emp to illustrate.  In scott.emp, there may be several lines for a single job.  To display only 1 row per job, hiredate line with the most recent:

    WITH got_r_num AS

    (

    SELECT empno, hiredate-, deptno, job or whatever columns you want

    ROW_NUMBER () taken OVER (PARTITION OF work

    ORDER BY hiredate DESC

    ) AS r_num

    FROM scott.emp

    -WHERE--if you need a filter put it here

    )

    SELECT *- or the list of all columns except r_num

    OF got_r_num

    WHERE r_num = 1

    ;

    What results do you want in the case of links?  Depending on your needs, you can add expressions of tiebreaker to the analytical ORDER BY clause or the use of RANK instead of ROW_NUMBER.

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.
    Point where the above query is to produce erroneous results, and explain, using specific examples, how you get the right results from data provided in these places.
    If you change the query at all, post your modified version.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002

  • Fastest way to SELECT different people, same date of birth, same ZIP (postal code)

    I have a pretty large table of people over 25 M records. There NAME, ADDRESS, DOB, ZIP, OTHER, etc.

    Ago total of about 9 M people separate for one person it might be more then a recording (that is, change of address, name, etc.)

    I want to choose the DISTINCT people born on the same date and in the same ZIP (postal) code. You are looking for the most effective way to do it.

    Any idea is welcome

    Hello

    Here's one way:

    WITH got_cnt AS

    (

    SELECT person_id, person_name, address, date of birth, zip - or other columns of your choice

    , COUNT (DISTINCT person_id) over (PARTITION BY dob, zip) AS cnt

    FROM table_x

    )

    SELECT *.

    OF got_cnt

    WHERE cnt > 1

    ORDER BY dob, zip

    ;

    It will be faster than other methods because it requires only 1 pass through the table.

  • Find a UNIQUE RECORD on both sides

    Hi, I want to find a unique record that is either A or B who wants to tell A NOT IN B & B NOT in one, here is the sample data

    A side
    -----------
    
    A_SUB_NUM        B_SUB_NUM        START_DATE_TIME         SIDE
    88912345        88912345           20120625000031         A
    77777733        77777733           20120625001608         A
    77777733        77777733           20120625000000         A
    
    
    B side
    -----------
    
    A_SUB_NUM     B_SUB_NUM        START_DATE_TIME    SIDE
    88912345      88912345         20120625000022      B
    88912345      88912345         20120625000028      B
    88912345      88912345         20120625000031      B
    77777733      77777733         20120625001607      B
    IF the START_DATE_TIME differ in 1 second, they are considered the same record, example: 77777733, 77777733, 20120625001608 in one hand is the same as 77777733, 77777733, 20120625001607 B side

    Here is my code, however it didtn give me the expected result that 88912345 have not been filter :(

    (
    SELECT  
    START_DATE_TIME
    ,A_SUB_NUM
    ,B_SUB_NUM
    ,SIDE
    FROM TEST_A t2
    WHERE (A_SUB_NUM, B_SUB_NUM ) NOT IN 
    (SELECT A_SUB_NUM, B_SUB_NUM FROM TEST_B
    where (
    start_date_time > to_char(to_date(t2.START_DATE_TIME,'yyyyMMddhh24miss')-60/86400,'yyyymmddhh24miss')
    and start_date_time < to_char(to_date(t2.START_DATE_TIME,'yyyyMMddhh24miss')+60/86400,'yyyymmddhh24miss')
    )
    )
    )
    
    UNION ALL
    
    (
    SELECT 
    START_DATE_TIME
    ,A_SUB_NUM
    ,B_SUB_NUM
    ,SIDE
    FROM TEST_B t1
    WHERE (A_SUB_NUM, B_SUB_NUM) NOT IN 
    (SELECT A_SUB_NUM, B_SUB_NUM  FROM TEST_A
    where (
    start_date_time > to_char(to_date(t1.START_DATE_TIME,'yyyyMMddhh24miss')-60/86400,'yyyymmddhh24miss')
    AND start_date_time < to_char(to_date(t1.START_DATE_TIME,'yyyyMMddhh24miss')+60/86400,'yyyymmddhh24miss')
    )
    )
    )
    
    This is the result from the query
    
    START_DATE_TIME     A_SUB_NUM     B_SUB_NUM     SIDE
    20120625000000     77777733         77777733       A
    
    
    Expected result should be
    START_DATE_TIME     A_SUB_NUM     B_SUB_NUM     SIDE
    20120625000000     77777733         77777733       A
    20120625000022     88912345         88912345       B
    20120625000028     88912345         88912345       B
    Here is the data dictionary
    CREATE TABLE TEST_A
    (A_SUB_NUM VARCHAR2(50),
     B_SUB_NUM VARCHAR2(50),
     START_DATE_TIME VARCHAR(50),
     SIDE VARCHAR2(2)
     );
    
    CREATE TABLE TEST_B
    (A_SUB_NUM VARCHAR2(50),
     B_SUB_NUM VARCHAR2(50),
     START_DATE_TIME VARCHAR(50),
     SIDE VARCHAR2(2)
     );
    
    INSERT INTO TEST_B
    VALUES ('88912345'    ,  '88912345'     ,    '20120625000022', 'B');
    INSERT INTO TEST_B
    VALUES ('88912345'    ,  '88912345'     ,    '20120625000028' , 'B');
    INSERT INTO TEST_B
    VALUES ('88912345'    ,  '88912345'     ,    '20120625000031', 'B');
    INSERT INTO TEST_B
    VALUES ('77777733'    ,  '77777733'     ,    '20120625001607', 'B');
    
    
    INSERT INTO TEST_A
    VALUES ('88912345'    ,  '88912345'     ,    20120625000031, 'A');
    INSERT INTO TEST_B
    VALUES ('77777733',  '77777733',    20120625000000, 'A');
    INSERT INTO TEST_B
    VALUES ('77777733'    ,  '77777733'     ,    20120625001608, 'A');
    Appreciate your help :)

    Hello

    First of all, I want to note that there is a typing error in the last one you gave instructions insert. Instead of INSERT INTO TEST_B
    VALUES ('77777733', '77777733', 20120625000000, ' A'), you probably want to post INSERT INTO TEST_A
    VALUES ('77777733', '77777733', 20120625000000, ' A') and also instead of INSERT INTO TEST_B
    VALUES ('77777733', '77777733', 20120625001608, ' A'), you probably want to post INSERT INTO TEST_A
    VALUES ('77777733', '77777733', 20120625001608, ' A').

    Here is a solution to your problem:

    select * from test_a;
    
    A_SUB_NUM                                          B_SUB_NUM                                          START_DATE_TIME                                    SIDE
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ----
    88912345                                           88912345                                           20120625000031                                     A
    77777733                                           77777733                                           20120625000000                                     A
    77777733                                           77777733                                           20120625001608                                     A    
    
    select * from test_b;
    
    A_SUB_NUM                                          B_SUB_NUM                                          START_DATE_TIME                                    SIDE
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ----
    88912345                                           88912345                                           20120625000022                                     B
    88912345                                           88912345                                           20120625000028                                     B
    88912345                                           88912345                                           20120625000031                                     B
    77777733                                           77777733                                           20120625001607                                     B    
    
    select *
    from test_a
    where   not exists (select *
                      from test_b
                      where abs(to_number(test_b.start_date_time) -
                                to_number(test_a.start_date_time)
                                ) <= 1
                        )
    union
     select *
    from test_b
    where   not exists (select *
                      from test_a
                      where abs(to_number(test_a.start_date_time) -
                                to_number(test_b.start_date_time)
                                ) <= 1
                        ) ;
    
    A_SUB_NUM                                          B_SUB_NUM                                          START_DATE_TIME                                    SIDE
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ----
    77777733                                           77777733                                           20120625000000                                     A
    88912345                                           88912345                                           20120625000022                                     B
    88912345                                           88912345                                           20120625000028                                     B    
    
  • How to remove the synchronization data?

    FF 29
    The answer in my opinion is to go to 'manage '.

    I sign in with my sync email and password.
    

    The choices are:

       Sign out
       Change password
       Delete account
    

    I don't want to delete the account. I just want to remove the synchronization data, so I can start over?
    How do I do that?

    Hi silat.

    Mind if I answer? For most everyone here answering the questions is a volunteer support and we do not work for Mozilla. We are just regular Firefox users like you who contribute to our time to help the Firefox community.

    As for your sync account, the only way I know how is to remove your sync data completely is to delete your account then sign in using the same e-mail address. I tried it on a new profile of every night and it passes through very well.
    Simply go to https://accounts.firefox.com/settings and select 'delete account '. Then just sign up again.
    A few other contributors may have another way to achieve (they could respond if they do), but that's the way I know how.

  • How to select multiple duplicates to remove

    I show multiple copies of the same songs in my itunes. It is probably because I have a few external drives with backups attached to my main PC. I want to store the Itunes library, and I know how to remove the duplicates, but can do for simple songs. I want to be able to select all duplicates and remove it at once. Does anyone know how I could do this?

    You can select a range of songs by selecting one, and then shift-click on another, you can add or remove individual tracks with ctrl + click and ctrl + shift + click can add a new group to the selection. However, I would recommend the following...

    iTunes can create duplicates if the same content is added several times from outside the media folder when it is about to make copies of everything that is added to the library, or is added from an external drive that hosts the press kit that was disconnected during the launch of iTunes.

    Official notice of Apple on the duplicates is here: find and remove duplicates in your iTunes library. This is a manual process and article fails to explain some of the potential pitfalls such as the lost coast and membership of playlist, or sometimes the same file can be represented by multiple entries in the library as well as a removal and recycling the file will break all the others.

    Use MAJ > display > show items to reproduce exactly to display the duplicates because it is normally a selection more useful. You must manually select all but one of each group to remove. Sort the list by Date added can make easier select appropriate tracks, but it works better when executed immediately after the dupes were created.  If you have several entries in iTunes connected to a same file on the disk hard then don't not send to trash.

    Use my DeDuper script (Windows only) If you are not sure, do not want to do it by hand, or want to maintain ratings, play counts and playlist membership. See this background thread , this post for detailed instructions and Please take note of the warning toback up your library before deduping.

    (If you don't see the menu bar press ALT to temporarily view or CTRL + B to keep displayed.)

    The latest version of the script can put away the dead links as long as there is at least a double live to merge his stats and membership of the playlist and must deal wisely when the same file has been added through multiple paths.

    TT2

  • restore points d ' training showing same date as c drive D drive is not checked

    I'm getting "low disk space" for drive recovery or D, HP Media center with Vista Home Premium32 computer bit. Recovery drive is red and date watch for drive C as of date, restoring shows the same date for D drive even if it is not checked. He has been checked before. I unchecked and it was going well until I did a manual restore point for a C drive. After that, I got a message of not enough space for the recovery disk and it shows that the same date and time the drive C. as far as I know that I am not store anything on the recovery disk, no backups are listed when I check hidden folders. There seems to be some cross linking going on. Is there something to dissociate. I have tried several things but nothing I've tried does not work. Hope someone knows the problem and has a solution. Thank you.

    Hello

    Your recovery Partition was photographed on your hard drive during the production of your computer by the manufacturer for all of these reasons.

    1. to reinstall Vista from in the case of a failure of the system, based on individuals or the keys at startup.

    F10 or Alt + F10 or F11 are a couple of different manufacturers use sequences.

    You will need to ask your manufacturer for proper sequence.

    HP is F11.

    2. to make the recovery disks on if your drive hard breaks down, so that you can then reinstall the operating system on a new hard drive.

    Also ask them how to make records.

    Here's how HP it:

    http://h10025.www1.HP.com/ewfrf/wc/document?DocName=c00809678&LC=en&DLC=en&cc=us&product=18703#WhenCreate

    Your D: Recovery Drive is should not be used for backups, defragmented, System Restore etc.

    There are backups on an external hard drive.

    To resolve the problems that have arisen with the recovery D: Partition, you will need to contact the manufacturer of your computer to remove all that has been added to it.

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

    And read this information from HP about your problem and how to fix it:

    «Error: low disk space.» You run lack of disk space on recovery (d :))"

    http://h10025.www1.HP.com/ewfrf/wc/document?DocName=c01508532&LC=en&cc=us&DLC=en

    See you soon.

  • retriving of unique records on two columns

    Hello world


    Using sql query, that he must retrieve unique records on two columns.

    Example of table source: raster columns [uwi, well_no]

    Examples of data below


    UWI well_no

    -----    --------

    1 988311

    1 988311

    1 1032662

    1 1032662

    2 103

    2 103

    2 103

    3

    3 104

    3 104

    3 104

    4 106

    4 107

    4

    4 108

    For a given

    UWI: 1 there are 4 well_no which is having two distinct values where these documents I need to go get

    UWI: 2 there are 3 well_no, all 3 well_no contains the same value as (103) Consequently, these documents should not seek

    UWI: 3 there are 4 well_no (1 null and 3 values are the same (104)] where these records should not seek.)

    UWI: 4 there are 4 well_no which is to have three separate with a single value zero so these 4 files, I need to get.

    output:

    UWI well_no

    -----    --------

    1 988311

    1 988311

    1 1032662

    1 1032662

    4 106

    4 107

    4

    4 108

    Thank you

    Jery

    Hi, Michel,.

    Whenever you have a question, please post CREATE TABLE and INSERT statements for your sample data, so people who want to help you can recreate the problem and test their ideas.

    Format your message so that it is easy to read and understand.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002

    Maybe you want something like this, which shows information about the jobs that have deptnos 2 or more not NULL:

    WITH got_cnt AS

    (

    SOME jobs, deptno

    , ACCOUNT (SEPARATE deptno) RESUMED (work PARTITION) AS cnt

    FROM scott.emp

    )

    SOME jobs, deptno

    OF got_cnt

    WHERE cnt > 1

    ;

  • How to identify columns that have the same data in a SQL query or function?

    Deal all,

    How to identify columns that have the same data in a SQL query or function? I have the sample data as below

    DEPT_IDEMP_IDCome on
    !CITYSTATECOUNTRY111 June 1983DELHIHUMAN RESOURCESIndia1218 January 1987DELHIHUMAN RESOURCESIndia1328 November 1985DELHIHUMAN RESOURCESIndia144 June 1985DELHIHUMAN RESOURCESIndia255 June 1983MUMBAIHDIndia266 June 1983MUMBAIHDIndia277 June 1983MUMBAIHDIndia288 Jun. 1983MUMBAIHDIndia399. June 1983GURGAONDLIndia31010 June 1983GURGAONDLIndia

    Now, I want to Indify columns that have the same data for the same Department ID.

    Is it possible in sql unique or do I have to write the function for this? Pls Help how to write?

    Thanks in advance.

    You can try this?

    WITH T1)

    DEPT_ID, EMP_ID, DATE OF BIRTH, CITY, STATE, COUNTRY

    ), ()

    SELECT 1, 1, TO_DATE('1.) June 1983', 'JJ. LUN. (YYYY'), 'DELHI', 'HR', 'INDIA' OF THE DUAL UNION ALL

    SELECT 1, 2, TO_DATE('18.) January 1987', 'JJ. LUN. (YYYY'), 'DELHI', 'HR', 'INDIA' OF THE DUAL UNION ALL

    SELECT 1, 3, TO_DATE('28.) November 1985', 'JJ. LUN. (YYYY'), 'DELHI', 'HR', 'INDIA' OF THE DUAL UNION ALL

    SELECT 1, 4, TO_DATE('4.) June 1985', 'JJ. LUN. (YYYY'), 'DELHI', 'HR', 'INDIA' OF THE DUAL UNION ALL

    SELECT 2.5, TO_DATE('5.) June 1983', 'JJ. LUN. (YYYY'), 'BOMBAY', 'HD', 'INDIA' OF THE DUAL UNION ALL

    SELECT 2.6, TO_DATE('6.) June 1983', 'JJ. LUN. (YYYY'), 'BOMBAY', 'HD', 'INDIA' OF THE DUAL UNION ALL

    SELECT 2.7, TO_DATE('7.) June 1983', 'JJ. LUN. (YYYY'), 'BOMBAY', 'HD', 'INDIA' OF THE DUAL UNION ALL

    SELECT 2.8, TO_DATE('8.) June 1983', 'JJ. LUN. (YYYY'), 'BOMBAY', 'HD', 'INDIA' OF THE DUAL UNION ALL

    SELECT 3, 9, TO_DATE('9.) June 1983', 'JJ. LUN. (YYYY'), 'GURGAON', 'DL', 'INDIA' OF THE DUAL UNION ALL

    SELECT 3.10, TO_DATE('10.) June 1983', 'JJ. LUN. (YYYY'), 'GURGAON', 'DL', 'INDIA' OF THE DOUBLE)

    SELECT DEPT_ID,

    RTRIM (XMLAGG (XMLELEMENT(A,VALS||',')). Extract ('//Text ()'), ',') COLUMNS_WITH_DUPLICATE

    DE)

    SELECT * FROM)

    SELECT DEPT_ID,

    EMP_ID,

    Date of birth

    CITY,

    STATE,

    COUNTRY

    DE)

    SELECT DEPT_ID,

    EMP_ID,

    Date of birth

    CITY,

    STATE,

    COUNTRIES,

    COUNT (*) OVER(PARTITION BY DEPT_ID ORDER BY EMP_ID DESC,DOB DESC,CITY DESC,STATE DESC, COUNTRY DESC) RN

    DE)

    SELECT DEPT_ID,

    CASE WHEN(CEID>1) AND THEN 'YES' ELSE 'NO' END AS EMP_ID.

    CASE WHEN(CDOB>1) THEN 'YES' ELSE 'NO' END AS DATE OF BIRTH,

    CASE WHEN(CCITY>1) AND THEN 'YES' ELSE 'NO' END AS CITY.

    CASE WHEN(CSTATE>1) AND THEN 'YES' ELSE 'NO' END AS STATE.

    CASE WHEN(CCOUNTRY>1) THEN 'YES' ELSE 'NO' END AS A COUNTRY

    DE)

    SELECT DISTINCT

    DEPT_ID,

    CEID,

    CDOB,

    CITY,

    CSTATE,

    CCOUNTRY

    DE)

    SELECT DEPT_ID,

    COUNT (*) TO THE CEID (DEPT_ID PARTITION, EMP_ID),.

    COUNT (*) ON CDOB (DEPT_ID SCORE, DATE OF BIRTH),

    COUNT (*) ON THE CITY (DEPT_ID PARTITION, CITY),

    COUNT (*) ON CSTATE (DEPT_ID PARTITION, STATE).

    COUNT (*) ON CCOUNTRY (DEPT_ID, COUNTRY PARTITION)

    FROM T1)))

    WHERE RN = 1)

    UNPIVOT (CLO FOR (VALS) IN (EMP_ID, DATE OF BIRTH, CITY, STATE, COUNTRY)))

    WHERE COLS = "YES".

    DEPT_ID GROUP;

    OUTPUT:

    DEPT_ID COLUMNS_WITH_DUPLICATE
    --------- ------------------------

    1 CITY, COUNTRY, STATE
    2 CITY, COUNTRY, STATE
    3 CITY, COUNTRY, STATE

    Post edited by: Parth272025

  • Help with the query to select only one record from the result set in double

    Hello

    Please help with the query. Version of Oracle database we use is 10g R2.

    I have a vision that is duplicated IDS, but they are used across the different functions. See below examples of data. Please help me with a query to select only one record (based on ID regardless of the area) from the bottom of the result set of duplicate records. For what is the point of view is there unique records, given the combination of the fields ID, Org, DF, dry, Sub-Sec

    ID
    Org
    DF
    Sec Sub-Sec

    (163)CQCPDMCPDMHD(163)PCENGENGENG(163)CQASICASICIS8888TSTACTACTAC(163)TSHEHESW6789CQINFOINFOFOS6789PCSECSYSSECSYSINFO16789TSSECSYSSECSYSINFO29009PCBMSBMSBMS1

    My result set must eliminate the duplicate identifiers regardless of whoever we choose of the result set. (I mean without distinction Org, DF, s, Sub-s). My expected result set should be.

    ID
    DSB

    DF
    SEC
    Sub-Sec
    (163)CQCPDMCPDMHD8888TSTACTACTAC6789CQINFOINFOFOS9009PCBMSBMSBMS1


    Thank you

    Orton

    Hello

    This sounds like a job for ROW_NUMBER:

    WITH got_r_num AS

    (

    SELECT id, DSB, df, s, sub_sec org

    ROW_NUMBER () OVER (PARTITION BY ID.

    ORDER BY org

    ) AS r_num

    OF view_x

    )

    SELECT id, DSB, df, sub_sec s,

    OF got_r_num

    WHERE r_num = 1

    ;

    He is a Top - N query example, where you choose the elements of N (N = 1 in this case) from the top of an ordered list.

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and INSERT, only relevant columns instructions) to your sample data and the results desired from these data.  (I know that you said that you were a view selection.  Just for this thread, pretending it is a picture and post simple CREATE TABLE and INSERT statements to simulate your point of view).
    Point where the above query is to produce erroneous results, and explain, using specific examples, how you get the right results from data provided in these places.  (I didn't quite understand the explanation above.  I don't know why you want to

    ID ORG DF DRY SUB_SEC

    --      ---     --      ---     -------

    1234 CQ DPRK DPRK HD

    and is not

    1234 IS CQ ASIC, ASIC

    or

    TS 1234 IT IT SW

    or

    1234 CQ ASIC ASIC HD

    )
    If you change the query at all, post your modified version.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002

  • How to create two different smart albums with photos with the same date?

    I created a smart album by using 'Date is' and ' keyword is EAA.»  (The photos have a keyword like "EAA" or "Flower".  Photos of keyword EAA & flower have the same date.)  When I use "Corresponding to all" are has no pictures in the album.  When I use "Match any" all the photos are in the album - EAA & flower.  I would like an album with only pictures of CEA for that date and another album with photos of flower with the same date.

    I get the same answer.  I can get the date and to a key word to work with 'all' selected, but not date and keywords.  So you will need two smart albums: one with date and ECA ('all' selected) and the other with date and flowers ('all' selected).

    Use the file menu option ➙ new Smart Album.

    Report the problem to Apple via https://www.apple.com/feedback/photos.html.

  • Windows restarts when I select the option to remove the program from the Control Panel files

    Windows 7 Home Premium 64-bit installed. System of the down stops and restarts whenever I select the option to remove programs from the control panel. First of all, the problem occurred when I upgraded the version of iTunes. Restoration has solved the problem. Same thing happened when I upgraded my version of PowerDVD. Restored again to solve the problem. Just installed Office 2010 and the problem came back. I don't seem to be able to install software without this problem. Any help gratefully received.

    Hi Rugger,

    Welcome to the community Microsoft and thanks for posting the question.

    This issue could be happen if system files have been corrupted or any third party application conflicts.

    I would suggest trying the following methods and check if it helps.

    Method 1:

    I suggest you perform a SFC Scan and check if it helps.

    Steps to perform a scan SFC:

    a. click Start, click principally made programs, Accessories, and open the command prompt.

    b. type the following command and press ENTER:

    sfc/scannow

    [The command sfc /scannow. analysis of all protected system files and replaces incorrect versions with appropriate Microsoft versions.]

    Once the scan is finished, close the command prompt window, restart the computer and check.

    Reference: http://support.microsoft.com/kb/929833

    Method 2:

    I suggest you perform a clean boot and check if it helps.

    Clean boot will check if any third-party application is causing the problem, as the clean boot helps eliminate software conflicts.

    How to solve the problem by running the clean boot in Windows 7: http://support.microsoft.com/kb/929135

    Note: once you have completed troubleshooting, perform the steps in the step 3: to reset the computer as usual.

    If you need Windows guru, do not hesitate to post your questions and we will be happy to help you.

  • 2 writers can add to the same data staged?


    Hello

    How can we get 2 entries to write on the same data staged without data loss? I need to write the rejected records to a staging of data in 2 different processes before exporting.

    Kind regards

    Ravi

    No, you can not do this. Ecrire write to different sets of data on stage, then use a process with the merge data stream to bring together them.

    Otherwise, use two different sets of data staged or data interfaces and add to export. Data interfaces means that you never staged. The staged data: you can choose whether or not to step in the configuration of the task (or run profile).

Maybe you are looking for

  • When I accepted the lightning, most of my emails disappeared: what should I do?

    I guess that Thunderbird has been updated automatically, and this time, the lightning came with it. I accepted this calendar and thought everything was fine. However, when I got to send an e-mail, I discovered that only emails visible were those of 2

  • Provide ((PC)) shortcut on the taskbar

    Provide ((PC)) shortcut on the taskbar [Moved from the community centre of Participation]

  • My DVD drive does not appear in Windows Explorer

    This morning my computer ran a scan virus and other things, and when this was done, my computer will not respond to any type of CD.  No DVD, CD or even disks with files stored on them.When I open windows Explorer, the drive from DVD (e) is not even m

  • Envy 17 t-j000 Quad BIOS Update F.53 kills Intel WiFi Connection

    Yes - Fine-I had that problem licked in September (see my previous posts) - but this is my daughter - and after being hounded mercilessly by the HP "assistant" she inadvisedly updated its BIOS for F53. Thank YOU HP - you killed its WiFi connectivity

  • VS wireless controllers. WISN Modules

    We are in the process of upgrading stand-alone mode for Lightweight AP we have about 200 access points in the campus. My question is is it better to get a wireless controllers that can only handle up to tp 100 AP or a module of WISN that can handle 3