SOUNDEX function for group

This table includes the id, the coutry, and the word soundex

ID Word word_soundex
1 Egypt E213
2 Ejypt E213
3 Yemen Y550
E524 England 4
5 Yemen Y550

I want to get results like this

Egypt 1.2
Yemen 2.5
England 4


I try to do

Select word, listagg (id, ',') in the group test by country group (order by id)

but e incorrect results.

Published by: Isabelle on August 7, 2012 22:48

Tags: Database

Similar Questions

  • analytical function for grouping?

    Hello @all

    10 gr 2

    Is it possible to use an analytical function for the next group request (example):
    SELECT job, ename, sal,
      ROW_NUMBER() OVER(PARTITION BY job ORDER BY empno) AS no,
      RANK() OVER(PARTITION BY job ORDER BY NULL) AS JobNo 
      FROM emp;
    The output is the following:
    JOB     ENAME     SAL     NO     JOBNO
    ANALYST     SCOTT     3000     1     1
    ANALYST     FORD     3000     2     1
    CLERK     SMITH     818     1     1
    CLERK     ADAMS     1100     2     1
    CLERK     JAMES     950     3     1
    CLERK     MILLER     1300     4     1
    MANAGER     Müller     1000     1     1
    MANAGER     JONES     2975     2     1
    ....
    The JobNo expected to increase group work and ename; my desired output should be like...:
    JOB     ENAME     SAL     NO     JOBNO
    ANALYST     SCOTT     3000     1     1
    ANALYST     FORD     3000     2     1
    CLERK     SMITH     818     1     2
    CLERK     ADAMS     1100     2     2
    CLERK     JAMES     950     3     2
    CLERK     MILLER     1300     4     2
    MANAGER     Müller     1000     1     3
    MANAGER     JONES     2975     2     3
    MANAGER     BLAKE     2850     3     3
    MANAGER     CLARK     2450     4     3
    PRESIDENT     KING     5000     1     4
    SALESMAN     ALLEN     1600     1     5
    SALESMAN     WARD     1250     2     5
    SALESMAN     MARTIN     1250     3     5
    SALESMAN     TURNER     1500     4     5
    How can I achieve this?

    This, perhaps?

    with emp as (select 1 empno, 'ANALYST' job, 'SCOTT' ename, 3000 sal from dual union all
                 select 2 empno, 'ANALYST' job, 'FORD' ename, 3000 sal from dual union all
                 select 3 empno, 'CLERK' job, 'SMITH' ename, 818 sal from dual union all
                 select 4 empno, 'CLERK' job, 'ADAMS' ename, 1100 sal from dual union all
                 select 5 empno, 'CLERK' job, 'JAMES' ename, 950 sal from dual union all
                 select 6 empno, 'CLERK' job, 'MILLER' ename, 1300 sal from dual union all
                 select 7 empno, 'MANAGER' job, 'Müller' ename, 1000 sal from dual union all
                 select 8 empno, 'MANAGER' job, 'JONES' ename, 2975 sal from dual union all
                 select 9 empno, 'MANAGER' job, 'BLAKE' ename, 2850 sal from dual union all
                 select 10 empno, 'MANAGER' job, 'CLARK' ename, 2450 sal from dual union all
                 select 11 empno, 'PRESIDENT' job, 'KING' ename, 5000 sal from dual union all
                 select 12 empno, 'SALESMAN' job, 'ALLEN' ename, 1600 sal from dual union all
                 select 13 empno, 'SALESMAN' job, 'WARD' ename, 1250 sal from dual union all
                 select 14 empno, 'SALESMAN' job, 'MARTIN' ename, 1250 sal from dual union all
                 select 15 empno, 'SALESMAN' job, 'TURNER' ename, 1500 sal from dual)
    select job, ename, sal,
           row_number() over(partition by job order by empno) no,
           dense_rank() over(order by job) jobno
    from   emp
    
    JOB     ENAME     SAL     NO     JOBNO
    ANALYST     SCOTT     3000     1     1
    ANALYST     FORD     3000     2     1
    CLERK     SMITH     818     1     2
    CLERK     ADAMS     1100     2     2
    CLERK     JAMES     950     3     2
    CLERK     MILLER     1300     4     2
    MANAGER     Müller     1000     1     3
    MANAGER     JONES     2975     2     3
    MANAGER     BLAKE     2850     3     3
    MANAGER     CLARK     2450     4     3
    PRESIDENT     KING     5000     1     4
    SALESMAN     ALLEN     1600     1     5
    SALESMAN     WARD     1250     2     5
    SALESMAN     MARTIN     1250     3     5
    SALESMAN     TURNER     1500     4     5
    
  • County, based on the soundex function

    Hi all

    I a bit confused with request asked of me.
    the query is
    indicate the account number of the last part of each word in the same row according to the soundex function
    for example
    the first line has set out four in the same line
    ACD BCD AAA
    AFD BCF
    BDE AAC AFC
    BCF AAE
    Does it say I have divided the each statement and get soundex for the last part which is located in this example is------.
    AAA
    BCF
    AFC
    AAE 
    So the soundex only for AAA and AAE is same average I've update table b in the column of Gen by two and son on for others.
    create table  a(id number(9), Gen_Value varchar2(200));
    
    insert into a vlaues(1, 'ACD BCD AAA, AFD BCF , BDE AAC AFC,BCF AAE');
    insert into a vlaues(2, 'AVF BCD, BBA BBG BCEV, GACD MNF BCV');
    insert into a vlaues(3, 'AFC ABC, BBG HUH ABCE, JHU KK MNK');
    
    
    create table  b(id number(9), Gen_Value varchar2(200), id number(9));
    insert into b values( 'AAA', '0',1);
    insert into b values ('BCEV  ','0',2);
    insert into b values ('AFC','0',1);
    insert into b values ('BCD','0',2);
    insert into b values ('MNK','0',3);
    insert into b values ('ABCE','0',3);
    The result is
    Gen   count  id 
    AAA    2     1
    BCEV   2     2
    AFC     1     1
    BCD     1     2
    MNK    1     3   
    ABCE  2     3
    see you soon
    Benjamin

    Published by: 973907 on November 29, 2012 12:54 AM

    Published by: 973907 on November 29, 2012 12:55

    973907 wrote:
    We choose one of them. 'AAA' or AAE. or the word that has long term.

    No prob

    with data as (
     select
      id
     ,gen_value||',' gen_value
     from a
    )
    ,r  (id, gen_value, l) as (
     select
      id
     ,substr(gen_value, instr(gen_value, ',') + 1)
     ,substr(
       trim(substr(gen_value,1, instr(gen_value, ',') - 1))
      ,instr(trim(substr(gen_value,1, instr(gen_value, ',') - 1)),' ',-1)
     )
    from data
    union all
     select
      id
     ,substr(gen_value, instr(gen_value, ',') + 1)
     ,substr(
       trim(substr(gen_value,1, instr(gen_value, ',') - 1))
      ,instr(trim(substr(gen_value,1, instr(gen_value, ',') - 1)),' ',-1)
     )
    from r
    where
    length(gen_value) > 0
    )
    
    select
     soundex(l)
    ,count(*) cnt
    ,max(l) keep ( dense_rank last order by length(l), l desc nulls first) v
    from r
    group by
     soundex(l)
    order by
     1
    
    SOUNDEX(L) CNT V
    A000 2 AAA
    A120 3 ABCE
    B210 3 BCEV
    B230 1 BCD
    M200 1 MNK 
    
  • BSOD network, related function for Winsock problem driver-related

    I'll give as much detail as possible in order to get the right answer.

    I'm working on HP G70 - 463CL with Vista Home Premium 64 - bit.

    The problem is that whenever we try to use something that would require a network function, I have a BSOD with the IRQL_NOT_LESS_OR_EQUAL.
    This occurs even if I plug in a network cable, try to run a web browser, or right-click on the signal wireless in the bottom task bar.

    When the computer reboots, I get the "Windows has recovered from an unexpected shutdown' with this information.
    Problem event name: BlueScreen
    The system version: 6.0.6002.2.2.0.768.3
    LocaleID: 1033

    More information about the problem:
    BCCode: a
    BCP1: 0000000000000000
    BCP2: 0000000000000002
    BCP3: 0000000000000001
    BCP4: FFFFF80002228C45
    OS version: 6_0_6002
    Service Pack: 2_0
    Product: 768_1

    He then lists the minidump file which I do not know how to open it.

    I went to HP and download the current network for the WLAN and LAN drivers. (I have uninstall the previous)

    I went to Services to see what didn't work and I got these errors when I tried to start them.

    The DHCP Client 1.) -Error 1068: the dependency service or group could start. So I clicked on the dependencies and seen that it relies on the "accessory function for Winsock driver" and the "WinHTTP Web Proxy Auto - Discovery Service" depends on DHCP.

    TCP/IP NetBIOS Helper 2 properties.) -a had the same message according to the 'related function pilot' and it depends on the NETBT.

    I have passed to the command window and tried ping 192.168.1.1, and got the error that transmit failed, error code 1231.

    I have also reset IP address and with the command netsh winsock

    I went to Device Manager and click on devices show hidden.

    Under the pilot no Plug and Play there was a yellow by 'Related function for Winsock driver' symbol when I click Properties, it says under the status it is not working properly or has not all the drivers installed (Code 24).
    I also had a yellow symbol of security processor Loader driver and the same information under properties.

    In searching the Internet, I tried several different things that I found and tried including change something in the registry.  At one point I was able to make wireless work and managed to get on the internet and ran Windows Update and downloaded several items.  After the reboot, I clicked on an Internet Explorer icon on the screen to come back on the internet and I got the blue screen again.

    I ran Malwarebytes and it found nothing.

    I uninstalled AVG 8.5 and was going to install a different virus protection and I have a feeling that this is where the problem started.

    So if anyone can offer help, I'd appreciate it.  I have a feeling that everything hinges on the related function driver but do not know how to reinstall.  The hard drive has a recovery partition, but I don't want to reinstall the OS.

    There are a few issues, including the duplicate property and lack of records relating to the CPU.

    While this can be traced back to file by file, the best way to solve the OS when SFC finds files that it cannot solve is to do a repair of the DVD of the OS installation.

  • How can we use the function of group based on time

    Hai sir

    I had a table containing fields

    EMPCODE NUMBER
    EMPNAME VARCHAR2 (25)
    BAR CODE VARCHAR2 (25)
    VARCHAR2 (25) RESPONDENT
    OUTTIME VARCHAR2 (25)
    INTRTIMEIN VARCHAR2 (25)
    INTROUTTIME VARCHAR2 (25)
    PERTIMEIN VARCHAR2 (25);
    PERTIMEOUT VARCHAR2 (25);
    DATE OF ATTEND_DATE;


    Who has six columns of time and I need to use the group function
    For example
    0815,0817,1230,1250,1645,1648,

    0815 should store in timein
    0817 must store in intrtimein
    1250 need to store in pertimein
    1230 must store in pertmeout
    1645 must store in intrtimeout
    1648 must store in the time-out period

    If it is possible using max and min function pls tell me.

    Thanks and greetings

    Srikkanth.M

    Hi, Srikanth,

    It would help a Lopez, if you posted CREATE TABLE and INSERT statements for a few lines of sample data and the results desired from these data.
    If you want a solution that works in your version of Oracle, say what is your version of Oracle.

    Are you trying to sort columns?
    In other words, you are waying that people can enter data in the six columns, in any order, and you want to reorder the values so that
    respondent<= intrtimein=""><= pertimein=""><= pertimeout=""><= introuttime=""><=>

    If so, you can unpivot data in 6 lines, use the ROW_NUMBER analytic function to number the lines in the order and their pivot then back in order:

    MERGE     INTO     table_x          dst
    USING     (     WITH  cntr as
              (       SELECT     LEVEL     AS n
                   FROM     dual
                   CONNECT BY     LEVEL     <= 6
              )
              ,     unpivoted     AS
              (     SELECT     t.empcode
                   ,     CASE     c.n
                             WHEN  1  THEN  intime
                             WHEN  2  THEN  outtime
                             WHEN  3  THEN  intrtimein
                             WHEN  4  THEN  introuttime
                             WHEN  5  THEN  pertimein
                             WHEN  6  THEN  pertimeout
                        END     AS tm
                   FROM          table_x     t
                   CROSS JOIN     cntr     c
              )
              ,     got_rnum     AS
              (
                   SELECT     empcode
                   ,     tm
                   ,     ROW_NUMBER () OVER ( PARTITION BY  empcode
                                            ORDER BY          tm
                                        ) AS rnum
                   FROM     unpivoted
              )
              SELECT       empcode
              ,       MAX (CASE WHEN rnum = 1 THEN tm END)     AS intime
              ,       MAX (CASE WHEN rnum = 2 THEN tm END)     AS intrintime
              ,       MAX (CASE WHEN rnum = 3 THEN tm END)     AS perintime
              ,       MAX (CASE WHEN rnum = 4 THEN tm END)     AS perouttime
              ,       MAX (CASE WHEN rnum = 5 THEN tm END)     AS introuttime
              ,       MAX (CASE WHEN rnum = 6 THEN tm END)     AS outtime
              FROM       got_rnum
              GROUP BY  empcode
         ) src
    ON     (dst.empcode     = src.empcode)
    WHEN MATCHED THEN UPDATE
    SET     dst.intime     = src.intime
    ,     dst.outtime     = src.outtime
    ,     dst.intrtimein     = src.intrintime
    ,     dst.introuttime     = src.introuttime
    ,     dst.pertimein     = src.perintime
    ,     dst.pertimeout     = src.perouttime
    ;
    

    It should work in Oracle 10 (and more).
    The PIVOT and UNPIVOT features introduced in Oracle 11 can make it a little simpler.

    Perhaps it would be better to require users to enter data in the right-hand columns.
    You can use CHECK constraints to ensure that intimate<= intrtimein=""><= pertimein=""><= pertimeout=""><= introuttime=""><=>

  • How can I do a quick preview (thumbnails?) of all open tabs in a window (Safari has a function for the display of open tabs)?

    How can I do a quick preview (thumbnails?) of all open tabs in a window (Safari has a function for the display of open tabs)?

    Maybe look into this extension instead:

  • What happened to the 'Reply' function for e-mail messages? How to do that now?

    The new Firefox is not easy to use. The former had the possibilities of action listed for easy access. Now, we have to hit a drop down selection menu that adds additional steps to perform the desired actions. There is also no place that allows the 'Reply' function for messages. Why is it that were eliminated?
    Experts in software, why they do things easier when everything they do is complicate its use for common people?

    Thank you. It was the answer to the problem. Why must it be grounded if secretly for novices must go through this process to get assistance to the fulfilment of the tasks? I know that's not your problem, what the site does, but I'm glad that you were able to help me and solve the problem.
    Thanks again for your expertise.

  • Satellite Z830-10W - timer function for the backlight on the keyboard

    Hey, I bought a Toshiba Satellite Z830-10W, that's a fine ultrabook.
    But I would like to have the timer function for backlight the keyboard work.

    The next update of the BIOS are change? Flemming regand

    Don t think that this feature is available
    Never seen any Toshiba laptop, including such meter for the backlight keys.

  • Jerky mouse mouseover function for all while the menu (file, options, help) and the key back/forward/home too. More scrolling is choppy every Web site.

    Jerky mouse mouseover function for all while the menu (file, options, help) and the key back/forward/home too. More scrolling is choppy every Web site since the update to version 3.6 to 4 RC1.

    Gel mouse pointer when it comes across objects that use some sort of animation or gradual highlighting when hovering on (which is basically all the Firefox 4 items menu, tabs, etc.) But also a lot of things on the Web pages as the green buttons on this page that change color when you hover over them).

    After rebooting my system, however, the problem seems to have disappeared!

    [, WinXP SP3 - 4 GB RAM, Core i5 M520, driver Nvidia NVS3100M 6.14.12.5738, Firefox 4.0]

  • A password works for all functions, for example, to connect to this forum?

    4, 32 MB, iOS 9.2, are different passwords required for different functions, for example, by accessing this forum on iPad?  I suspect that I am the problem, but I follow tangle in passwords,.

    the password log in here is appleId password

  • I can't send messages, whatsapp for group discussions and I think that is the update of ios software that is not compatible with my iphone 5 s

    I can't send messages, whatsapp for group discussions and I feel really lost. my friends can't receive my message and I am only able to send individual text messages. I think that its because of the version update of ios which is not compatible with my iphone 5 s. is a solution to this problem?

    I have the same problem, started this morning.

    I'm in iOS 9.1, using the iPhone 6. Don't know what happened, but I have also opened a disturbance with Whatsapp support as well.

    A focus group work, group chat messages cannot be delivered. Individual messages are working properly. I tried to remove and reinstall the application, remove the discussion group and recreate, all has not helped.

    A lack of ideas.

  • (1) is there a function for all the object of the same size?

    (1) is there a function for all the object of the same size?

    Sorry, I thought you wanted to align the objects.

    We do not have the function to make items of the same size. You must change one by one. To change the .lks file may be more effective.

  • Spectrum X 360: Function for the spectrum x 360 keys

    The arrows with the function key act as page, up, down, start and end. I want to use these keys a lot. Is there a way to set the keyboard for functions are reversed? On my Mac, I can by default the function for on button. Such a feature would make page upward, active down without the function key and the active arrows with the function key.

    Thank you very much for the comments and you are right that to access the function keys on the arrow key you will need to hold down the FN key.

    If I hear of a different method on changing these options with the arrow keys will let you know.

  • Disable the column key functional for an individual of forms

    Hi all

    I have a block of multiple registration details in my form with fields (type, point, wt, vehicle number etc.). Keys are already scheduled for functional use as f3 to copy.

    In my form, I want to use the copy function to get to the fields as type, point, wt, but not for the vehicle number column. IE type, point, maybe same wt columns but number of vehicle may not be same (according to customer requirement). They will not accidentally copying the same number of vehicle.

    For this I need to disable the copy (F3) function for this vehicle only number column.

    Is there a workaround for this...

    My version of the form is 10g

    Thanks in advance

    Concerning

    JaKes

    the KEY-F3-trigger has nothing to do with the F3 function key. In client-server F3 is associated with the DUPLICATE_ITEM function, so you should use the KEY-DUPITM-trigger.

    Also, if you implement a release BUTTON, it replaces the functionality by default, so you must manage the service for yourself.

    As for the OP functionality should just be deleted at one, the simplest solution is to create KEY-DUPITM-relaxation so precise and simple insert a value that is NULL. inside.

  • How to know the name (package, procedures or functions) for current sessions

    Hi all

    I am DBA and I want to find a way to get the object name regardless (packages, procedures or functions) for the current statement running in the current session.

    To specify when I open the browser session of Toad, I can see the active sessions and the current statement for each session, but without the name of the object.


    Is it possible to know this point.

    Thanks in advance

    Select *.

    from dba_objects

    When object_id in (select nvl (t.PLSQL_ENTRY_OBJECT_ID-1)

    v $ session t

    where sid = 452)

    -----

    Ramin Hashimzade

Maybe you are looking for