How to coalesce many rows into one?

I am using SSMS 2008 R2 and am simply trying to coalesce many rows into one. This should be simple I think, but it is currently repeating data in each row. Consider:
create table test
Name varchar(30)
insert test values('A'),('B'),('C')
select * from test
select distinct Name, coalesce(Name + ', ', '')
from test
How can I rewrite this to achieve one row like: A,B,C
Ryan D

Or as a variation
Declare @S varchar(MAX)
set @S = ''
select @S = @S + ', ' +Name
from test
Select substring(@s, 2, length(@s))
Would be interested to know performance difference between this style and the XMLPath used by Naomi though. The XMLPath technique certainly looks cleaner
A samll correction for RyanAB's solution:
Select substring(@s, 2, len(@s))
For more information about Len(), please see:
http://technet.microsoft.com/en-us/library/ms190329.aspx
If you have any feedback on our support, please click
here.
Regards,
Elvis Long
TechNet Community Support

Similar Messages

  • How to combine many rows into one row

    Hi all,
    I have a question regarding to how to combine many rows into one row?
    My result set is like that:
    ITEM_NO NAME1
    11 abc
    11 cde
    11 fg
    Want to combine them into
    ITEM_NO NAME1
    11 abc;cde;fg
    would anybody can tell me how to do that? Thanks
    Ray

    You can check this --
    satyaki>
    satyaki>
    satyaki>create table t
      2  as
      3      select 11 ITEM_NO, 'abc' NAME1 from dual
      4      union all
      5      select 11 ITEM_NO, 'cde' NAME1 from dual
      6      union all
      7      select 11 ITEM_NO, 'fg' NAME1 from dual;
    Table created.
    satyaki>
    satyaki>
    satyaki>
    satyaki>set lin 10
    satyaki>
    satyaki>desc t;
    Name              Null?    Type
    ITEM_NO                    NUMBER
    NAME1                      VARCHAR2(3)
    satyaki>
    satyaki>
    satyaki>set lin 1000
    satyaki>
    satyaki>
    satyaki>
    satyaki>SELECT ITEM_NO,
      2         LTRIM(MAX(SYS_CONNECT_BY_PATH(NAME1,';'))
      3         KEEP (DENSE_RANK LAST ORDER BY curr),';') AS NAME1_DET
      4  FROM   (SELECT ITEM_NO,
      5                 NAME1,
      6                 ROW_NUMBER() OVER (PARTITION BY ITEM_NO ORDER BY NAME1) AS curr,
      7                 ROW_NUMBER() OVER (PARTITION BY ITEM_NO ORDER BY NAME1) -1 AS prev
      8          FROM   t)
      9  GROUP BY ITEM_NO
    10  CONNECT BY prev = PRIOR curr AND ITEM_NO = PRIOR ITEM_NO
    11  START WITH curr = 1;
       ITEM_NO  NAME1_DET
            11  abc;cde;fgRegards.
    Satyaki De.

  • How to merge many rows into one row

    hello,
    I have two tables T1, T2.
    T1 (ID NUMBER, TEXT VARCHAR2(1000))
    T2 (POS NUMBER, LINE VARCHAR(100))
    Is it posible to get all rows of T2.LINE concated and insert them into T1.TEXT?
    Thank you for any help.

    SELECT ID, text, NULL pos, NULL line
      FROM t1
    UNION ALL
    SELECT NULL ID, NULL text, pos, line
      FROM t2regards,
    friend

  • How to turn many rows into one row with many coloums

    When I have a table for example
    NR   DATA
    1     abc
    2     dfg
    3     hijI must convert this into a view that would look like:
    1        2         3
    abc    dfg       hijThe number of rows is dynamic. So I cannot make a static view.
    I cannot use pivot because I use Oracle 10g.
    Can anyoune help me?
    Edited by: WoMo on 25.04.2013 07:23

    Hi,
    WoMo wrote:
    My NR values and DATA values are not known!You can use String Aggregation for that. See {message:id=10963258}
    For more options, see {message:id=3527823}
    I hope this answers your question.
    If not, post your best attempt, along with a little sample data (CREATE TABLE and INSERT statements), and also post the results you want from that data.
    See the forum FAQ {message:id=9360002}

  • How to combine many rows into 1 rows in 1 column?

    Hi all,
    I have a question regarding to how to combine many rows into one row?
    My result set is like that:
    ITEM_NO NAME1
    11 abc
    11 cde
    11 fg
    Want to combine them into
    ITEM_NO NAME1
    11 abc;cde;fg
    would anybody can tell me how to do that? Thanks
    Ray

    Hi,
    select * from x2;
    INO NAME
    13 PQR
    11 ABC
    11 DEF
    12 JKL
    12 MNO
    11 GHI
    select p.ino as ITEMNO,
           substr(max(substr(sys_connect_by_path (p.name,';'),2)),1,60) as ITEMNAME
    from (select ino,name,
          row_number()over (partition by ino order by ino, name) rn
    from x2) p
    start with p.rn = 1
    connect by p.rn = prior p.rn + 1
    and prior p.ino = p.ino
    group by ino;
    OP
    ITEMNO ITEMNAME
    11 ABC;DEF;GHI
    12 JKL;MNO
    13 PQR cheers
    Nirmal

  • How to club two rows into one

    hi
    Can we club two rows of a SQL statement into one , that is some column results from one row and other column result from second row, but the row must remain same .
    thanks
    imran

    SQL> with sample as (select 'A' supplier, 1000 total, 0 branch_total from dual
      2                union all
      3  select 'A' supplier, 0 total, 500 branch_total from dual
      4                union all
      5  select 'B' supplier, 300 total, 0 branch_total from dual
      6                union all
      7  select 'B' supplier, 0 total, 120 branch_total from dual)
      8  SELECT SUPPLIER , SUM(TOTAL) , SUM(BRANCH_TOTAL) FROM SAMPLE
      9    GROUP BY SUPPLIER
    10  /
    SUPPLIER SUM(TOTAL) SUM(BRANCH_TOTAL)
    A              1000               500
    B               300               120

  • How to Group Few Rows into One Rows In Query

    Dear All,
    I've use the "Group By" syntax in my query, but when the result display, it still show few rows instead of one row.
    Current Results
    item         Jan       Feb        Mar
    A              10          0           20
    A              10          0            0
    A               0           5            0
    B               0           0           10
    Desire Result
    item        Jan         Feb         Mar
    A             20           5           20
    B             0             0           10
    My query is:
    /*select from [dbo].[oinv] T0 */
    declare @customer varchar (200)
    /* where */
    set @customer = /* T0.Cardname */ '[%A]'
    /*select from [dbo].[inv1] T1 */
    declare @fromdate as datetime
    /* where */
    set @fromdate = /* T1.DOCDATE */ '[%1]'
    /*select from [dbo].[inv1] T2 */
    declare @tilldate as datetime
    /* where */
    set @tilldate = /* T1.DOCDATE */ '[%2]'
    SELECT inv1.ITEMCODE, oitm.itemname,
    CASE WHEN MONTH(INV1.DOCDATE) = 1 THEN SUM(QUANTITY) ELSE NULL END AS 'JAN',
    CASE WHEN MONTH(INV1.DOCDATE) = 2 THEN SUM(QUANTITY) ELSE NULL END AS 'FEB',
    CASE WHEN MONTH(INV1.DOCDATE) = 3 THEN SUM(QUANTITY) ELSE NULL END AS 'MAR',
    CASE WHEN MONTH(INV1.DOCDATE) = 4 THEN SUM(QUANTITY) ELSE NULL END AS 'APR',
    CASE WHEN MONTH(INV1.DOCDATE) = 5 THEN SUM(QUANTITY) ELSE NULL END AS 'MAY',
    CASE WHEN MONTH(INV1.DOCDATE) = 6 THEN SUM(QUANTITY) ELSE NULL END AS 'JUN',
    CASE WHEN MONTH(INV1.DOCDATE) = 7 THEN SUM(QUANTITY) ELSE NULL END AS 'JUL',
    CASE WHEN MONTH(INV1.DOCDATE) = 8 THEN SUM(QUANTITY) ELSE NULL END AS 'AUG',
    CASE WHEN MONTH(INV1.DOCDATE) = 9 THEN SUM(QUANTITY) ELSE NULL END AS 'SEPT',
    CASE WHEN MONTH(INV1.DOCDATE) = 10 THEN SUM(QUANTITY) ELSE NULL END AS 'OCT',
    CASE WHEN MONTH(INV1.DOCDATE) = 11 THEN SUM(QUANTITY) ELSE NULL END AS 'NOV',
    CASE WHEN MONTH(INV1.DOCDATE) = 12 THEN SUM(QUANTITY) ELSE NULL END AS 'DEC'
    FROM OINV inner join inv1 on oinv.DocEntry = inv1.DocEntry INNER JOIN OITM on inv1.itemcode = oitm.itemcode
    WHERE oinv.cardname =@customer AND inv1.DOCDATE >=@fromdate AND inv1.DOCDATE <=@tilldate
    GROUP BY inv1.ITEMCODE, oitm.itemname, inv1.docdate
    I've tried to write in "Select Syntax" too, but still get the same result. I'm really have no idea what's wrong with my query. Thanks for all your help!
    Cheers,
    Serene

    Hi Serene,
    in last query I forgot in subquery condition for customer (the sum was for all customers).
    Try this:
    SELECT distinct inv1.ITEMCODE, oitm.itemname,
    (select coalesce(sum(x.quantity),0) from inv1 x with(nolock), oinv xx with(nolock) where  xx.docentry = x.docentry and xx.cardname = @customer and inv1.itemcode = x.itemcode and month(x.docdate ) = 1 and x.DOCDATE >=@fromdate AND x.DOCDATE <=@tilldate) as 'JAN',
    (select coalesce(sum(x.quantity),0) from inv1 x with(nolock), oinv xx with(nolock)  where  xx.docentry = x.docentry and xx.cardname = @customer and inv1.itemcode = x.itemcode and month(x.docdate ) = 2 and x.DOCDATE >=@fromdate AND x.DOCDATE <=@tilldate) as 'FEB',
    (select coalesce(sum(x.quantity),0) from inv1 x with(nolock), oinv xx with(nolock)  where  xx.docentry = x.docentry and xx.cardname = @customer and inv1.itemcode = x.itemcode and month(x.docdate ) = 3 and x.DOCDATE >=@fromdate AND x.DOCDATE <=@tilldate) as 'MAR',
    (select coalesce(sum(x.quantity),0) from inv1 x with(nolock), oinv xx with(nolock)  where xx.docentry = x.docentry and xx.cardname = @customer and  inv1.itemcode = x.itemcode and month(x.docdate ) = 4 and x.DOCDATE >=@fromdate AND x.DOCDATE <=@tilldate) as 'APR',
    (select coalesce(sum(x.quantity),0) from inv1 x with(nolock), oinv xx with(nolock)  where xx.docentry = x.docentry and xx.cardname = @customer and  inv1.itemcode = x.itemcode and month(x.docdate ) = 5 and x.DOCDATE >=@fromdate AND x.DOCDATE <=@tilldate) as 'MAY',
    (select coalesce(sum(x.quantity),0) from inv1 x with(nolock), oinv xx with(nolock)  where xx.docentry = x.docentry and xx.cardname = @customer and  inv1.itemcode = x.itemcode and month(x.docdate ) = 6 and x.DOCDATE >=@fromdate AND x.DOCDATE <=@tilldate) as 'JUN',
    (select coalesce(sum(x.quantity),0) from inv1 x with(nolock), oinv xx with(nolock)  where xx.docentry = x.docentry and xx.cardname = @customer and  inv1.itemcode = x.itemcode and month(x.docdate ) = 7 and x.DOCDATE >=@fromdate AND x.DOCDATE <=@tilldate) as 'JUL',
    (select coalesce(sum(x.quantity),0) from inv1 x with(nolock), oinv xx with(nolock)  where xx.docentry = x.docentry and xx.cardname = @customer and  inv1.itemcode = x.itemcode and month(x.docdate ) = 8 and x.DOCDATE >=@fromdate AND x.DOCDATE <=@tilldate) as 'AUG',
    (select coalesce(sum(x.quantity),0) from inv1 x with(nolock), oinv xx with(nolock)  where xx.docentry = x.docentry and xx.cardname = @customer and  inv1.itemcode = x.itemcode and month(x.docdate ) = 9 and x.DOCDATE >=@fromdate AND x.DOCDATE <=@tilldate) as 'SEP',
    (select coalesce(sum(x.quantity),0) from inv1 x with(nolock), oinv xx with(nolock)  where xx.docentry = x.docentry and xx.cardname = @customer and  inv1.itemcode = x.itemcode and month(x.docdate ) = 10 and x.DOCDATE >=@fromdate AND x.DOCDATE <=@tilldate) as 'OCT',
    (select coalesce(sum(x.quantity),0) from inv1 x with(nolock), oinv xx with(nolock)  where xx.docentry = x.docentry and xx.cardname = @customer and  inv1.itemcode = x.itemcode and month(x.docdate ) = 11 and x.DOCDATE >=@fromdate AND x.DOCDATE <=@tilldate) as 'NOV',
    (select coalesce(sum(x.quantity),0) from inv1 x with(nolock), oinv xx with(nolock)  where xx.docentry = x.docentry and xx.cardname = @customer and inv1.itemcode = x.itemcode and month(x.docdate ) = 12 and x.DOCDATE >=@fromdate AND x.DOCDATE <=@tilldate) as 'DEC'
    FROM OINV
    inner join inv1 on oinv.DocEntry = inv1.DocEntry
    INNER JOIN OITM on inv1.itemcode = oitm.itemcode
    WHERE oinv.cardname =@customer and quantity > 0
    AND inv1.DOCDATE >=@fromdate AND inv1.DOCDATE <=@tilldate

  • How to group Similar Rows into One Row  ?? Suggestions??

    Hi there , I am having a problem in my project you see I have 2 dimensions in my cube called Username and Symbols and a measure called M1.
    You see in the Symbol dimension there is repeated data in multiple rows such as the following
    Pepsi
    Pepsi
    Pepsi
    CocalCola
    Now when i display the dimension Username with the dimension Symbol using the Measure value M1. I get something like this
    UserName A
    Pepsi---- 10
    Pepsi---- 10
    Pepsi---- 10
    CoacalCola--- 20
    Now in the above table UserNameA represents a member of Username Dimension and cold drinks represent members of the Symbol Dimension
    and the numarical value represents the measure M1.
    I want it to appear something like this
    UserName A
    Pepsi 30 (Notice The measures of Pepsi have been added)
    CocalCola 20
    Any idea on how i can accomplish this or tip i would be really thankful

    Hi
    Use the aggregator operator in mapping. You can use the SUM function on the columns you wish to sum for example, and group by the other columns.
    Cheers
    David

  • Merging rows into one row but into SEPARATE Columns

    Hello Gurus,
    I have searched alot on OTN and many other places, but no where I could get the solution of how can we merge rows into one row but separate column. For example
    Consider the below scenario
    "DEPARTMENT", "EMP","NAME","SUBJECT"
    "Electronics","1","Sam","LIC"
    "Electronics","2","Pam","VLSI"
    "Electronics","3","Tom","C"
    "Mech","1","Abu","Thermo"
    "Mech","4","Lina","Machines"Now, I need the output like
    Based on Department as Group By Clause
    "DEPARTMENT", "EMP1","NAME1","SUBJECT1","EMP2","NAME2","SUBJECT2","EMP3","NAME3","SUBJECT3"
    "Electronics","1","Sam","LIC","2","Pam","VLSI","3","Tom","C"
    "Mech","1","Abu","Thermo","4","Lina","Machines"
    The row data to be loaded into separate columns. Name of the column is not an issue... can be anythingIn all the forums which I went through I could find them loading into a single column, but not into respective separate columns.
    Any help would be much appreciated.
    Thanks

    848265 wrote:
    Frank,
    I saw your name nearly n number of times, as I went through many forums today... And the link which you have just posted, I went through it today afternoon.
    Could you please explain this bit taken from your dynamic pivot post.
    SELECT     DISTINCT
         ',     COUNT (CASE WHEN job = '''
    ||     job
    ||     ''' '     AS txt1
    ,     'THEN 1 END)     AS '
    ||     job
    ||     '_CNT'     AS txt2
    FROM     scott.emp
    ORDER BY     txt1;Many Thanks.You only need that when you need column aliases based on the actual data (and you explicitly said you don't need that) or when can't put an upper bound on the number of columns to be displayed. If that doesn't apply to this problem, then don't use any kind of dynamic SQL (like the code above); it makes the job much more difficult, less efficient and less robust.
    Here's what the code above is doing.
    If you were hard-coding a query that showed the number of people in each job, and you knew that the possible jobs were 'ANALYST', 'CLERK' and 'MANAGER', then you might hard-code a query like this:
    SELECT    deptno
    ,       COUNT (CASE WHEN job = 'ANALYST'  THEN 1 END)     AS analyst
    ,       COUNT (CASE WHEN job = 'CLERK'    THEN 1 END)     AS clerk
    ,       COUNT (CASE WHEN job = 'MANAGER'  THEN 1 END)     AS manager
    FROM       scott.emp
    GROUP BY  deptno
    ;If the jobs had different names, or if there were not 3 different jobs, then you would have to change the lines in the SELECT clause that start with ", COUNT ( CASE ...".
    The code you posted is from an example of dynamic SQL, where you first run a Preliminary Query . (What you posted above is, in fact, the complete preliminary query.) The output of that preliminary query is exactly the variable part of the real query, such as:
    ,       COUNT (CASE WHEN job = 'ANALYST'  THEN 1 END)     AS analyst
    ,       COUNT (CASE WHEN job = 'CLERK'    THEN 1 END)     AS clerk
    ,       COUNT (CASE WHEN job = 'MANAGER'  THEN 1 END)     AS managerYou then use this output as part of your main query. In other words, you can write something today that will generate exacrly as many columns as you need next year, with names from the data as it is next year. How? because you're not writing the full query today. The variable part will be written by the preliminary query when it runs next year.

  • My wife and I have made many purchases over several years on seperate accounts, how could we join them into one account, without losing everything?

    My wife and I have made many purchases over several years on seperate accounts, how could we join them into one account, without losing everything? We both use Iphone 5's and share an Imac at home.

    Purchases using one Apple ID cannot be merged or transferred to another Apple ID. Purchases are forever tied to that Apple ID used. You have to decide which Apple you want to use for purchases and stick to that Apple ID so that you can share: Settings > iTunes & App Stores > Apple ID : > use the same Apple ID here to share purchases.

  • I have many duplicates of songs in my library, how do I consolidate them into one copy each without deleting each one individually?

    I hae many duplicates of songs in my library how do i consolidate them into one copy each without deleting each one individually?

    yea... i faced this problem many a time... have run apple sceipts to delete these songs....
    you download these scripts from the link below.... jus follow thw instructions... and you are free from duplicates
    http://dougscripts.com/apps/dupinapp.php
    hope this helps..!

  • How to concatenate many rows to be one row?

    Hi,
    How can I do if I concatenate two rows or many rows become one row in the same column with different values (CHAR or VARCHAR2). It's possible to do that?
    Ex:
    Column A
    ABCD
    EFGH
    to become
    Column A
    ABCDEFGH....
    Anybody can help me, please...
    I will very appreciated.
    Thanks,
    Leny

    I'm not sure if SQL Plus supports this feature. But programmatically it is possible if you use oracle procedure. Also if you're using some front end application (like VB, ASP etc) where you need the concatenated result then you can easily concatenate all rows under a loop on Recordset.

  • List aggregate two rows into one

    query :
    select kod_negeri.NAMA kod_negeri_nama,
    hakmilik.id_hakmilik,
    MOHON.PENYERAH_NAMA,
    MOHON.PENYERAH_ALAMAT1, MOHON.PENYERAH_ALAMAT2, MOHON.PENYERAH_ALAMAT3,
    MOHON.PENYERAH_ALAMAT4, MOHON.PENYERAH_POSKOD, MOHON.PENYERAH_KOD_NEGERI,
    MOHON.PENYERAH_NO_RUJ, MOHON.ID_MOHON, HAKMILIK.KOD_HAKMILIK, HAKMILIK.NO_HAKMILIK,
    KOD_LOT.NAMA, HAKMILIK.NO_LOT, KOD_BPM.NAMA, KOD_DAERAH.NAMA,
      LELONG.TMPT, LELONG.DIMASUK, PGUNA.NAMA,
      PIHAK.ALAMAT1, pihak.NAMA ven,
    PIHAK.ALAMAT2, PIHAK.ALAMAT3, PIHAK.ALAMAT4, PIHAK.POSKOD,
    mohon.id_mohon ,
    pguna.NAMA pguna_nama,
    pguna.JAWATAN,
    kod_daerah.NAMA kod_daerah_nama,
    to_char(enkuiri.TRH_enkuiri,'DD')||' '|| to_char(enkuiri.TRH_enkuiri,'MONTH','nls_date_language=malay') ||' '||TO_CHAR (enkuiri.TRH_enkuiri, 'YYYY') trh_enkuiri,
    to_char(lelong.TRH_lelong,'DD')||' '|| to_char(lelong.trh_lelong,'MONTH','nls_date_language=malay') ||' '||TO_CHAR (lelong.TRH_lelong, 'YYYY') trh_le,
    to_char(lelong.trh_lelong, 'Day') day,
    to_char(lelong.TRH_lelong,'HH12:MI ')  hour,
    DECODE(SUBSTR(to_char(lelong.TRH_lelong,'HH12:MI AM'),-2,2),'AM','Petang','pagi')  noon,
    enkuiri.cara_lelong,
    lelong.TMPT,
    lelong.HARGA_RIZAB,
    enkuiri.harga_rizab,
    initcap(pihak.NAMA) pihak_nama,
    initcap(lelong.EJA_RIZAB) er,
    'RM'||enkuiri.TUNGGAK_AMAUN,
    lelong.DEPOSIT,
    convert_number_words(lelong.DEPOSIT) as converted_form,
    to_char(lelong.TRH_AKHIR_BYR,'DD')||' '|| to_char(lelong.TRH_AKHIR_BYR,'MONTH','nls_date_language=malay') ||' '||TO_CHAR (lelong.TRH_AKHIR_BYR, 'YYYY') TRH_AKHIR_BYR,
    to_char(sysdate,'DD') ||' '|| to_char(sysdate,'MONTH','nls_date_language=malay') ||' '||to_char(sysdate,'yyyy') sysd,
    kod_bpm.NAMA kod_bpm_nama,
    kod_lot.NAMA kod_lot_nama,
    hakmilik.NO_LOT,
    hakmilik.KOD_HAKMILIK,
    hakmilik.NO_HAKMILIK
    from
    mohon ,
    mohon_hakmilik ,
    lelong ,
    pguna ,
    pihak ,
    kod_daerah ,
    enkuiri ,
    kod_bpm ,
    hakmilik ,
    kod_lot ,
    kod_negeri,
    mohon_fasa ,
    kod_hakmilik
    WHERE mohon.id_mohon = mohon_hakmilik.id_mohon and
    mohon_hakmilik.id_hakmilik = hakmilik.id_hakmilik and
    hakmilik.kod_hakmilik = kod_hakmilik.kod(+) and
    hakmilik.kod_lot  = kod_lot.kod(+) and
    hakmilik.kod_bpm = kod_bpm.kod(+) and
    hakmilik.kod_daerah = kod_daerah.kod(+) and
    mohon.id_mohon = enkuiri.id_mohon and 
    lelong.id_pihak = pihak.id_pihak and
    lelong.id_mh = mohon_hakmilik.id_mh and
    pihak.kod_negeri = kod_negeri.kod(+) and
    mohon.id_mohon = mohon_fasa.id_mohon and
    mohon_fasa.id_aliran ='semakan' and
    mohon_fasa.id_pguna = pguna.id_pguna and
    mohon.id_mohon = :p_id_mohon
    and enkuiri.KOD_STS='AK'
    and mohon.id_mohon ='0405AUC2010007436'KOD_NEGERI_NAMA,ID_HAKMILIK,PENYERAH_NAMA,PENYERAH_ALAMAT1,PENYERAH_ALAMAT2,PENYERAH_ALAMAT3,PENYERAH_ALAMAT4,PENYERAH_POSKOD,PENYERAH_KOD_NEGERI,PENYERAH_NO_RUJ,ID_MOHON,KOD_HAKMILIK,NO_HAKMILIK,NAMA,NO_LOT,NAMA_1,NAMA_2,TMPT,DIMASUK,NAMA_3,ALAMAT1,VEN,ALAMAT2,ALAMAT3,ALAMAT4,POSKOD,ID_MOHON_1,PGUNA_NAMA,JAWATAN,KOD_DAERAH_NAMA,TRH_ENKUIRI,TRH_LE,DAY,HOUR,NOON,CARA_LELONG,TMPT_1,HARGA_RIZAB,HARGA_RIZAB_1,PIHAK_NAMA,ER,'RM'||ENKUIRI.TUNGGAK_AMAUN,DEPOSIT,CONVERTED_FORM,TRH_AKHIR_BYR,SYSD,KOD_BPM_NAMA,KOD_LOT_NAMA,NO_LOT_1,KOD_HAKMILIK_1,NO_HAKMILIK_1
    Johor,050503PM00000151,HAMZAH DAUD DAROS & SITI NOR,NO 12 1ST FLOOR & 2ND FLOOR,JLN SRI RAHANG,TMN SRI RAHANG,SEREMBAN,58000,05,12345,0405AUC2010007436,PM,151,Lot,6309,Mukim Lenggeng,Seremban,PTG MELAKA,pptlelong1,Puan Nur Faizati,ASDFSAF,AHMAD,DSFDS,FDSFSDF,DSFSDF,12345,0405AUC2010007436,Puan Nur Faizati,Penolong Pegawai Tanah Lelong (PTD),Seremban,08 DISEMBER 2010,27 JANUARI 2011,Thursday ,02:00 ,pagi,A,PTG MELAKA,,,Ahmad,,RM234,,,24 MEI 2011,10 FEBRUARI 2011,Mukim Lenggeng,Lot,6309,PM,151
    ,050540HSD00022923,HAMZAH DAUD DAROS & SITI NOR,NO 12 1ST FLOOR & 2ND FLOOR,JLN SRI RAHANG,TMN SRI RAHANG,SEREMBAN,58000,05,12345,0405AUC2010007436,HSD,22923,Lot,0009838,Mukim Jimah,Seremban,PTG MELAKA,pptlelong1,Puan Nur Faizati,no2,Ali Bin Abudillah,jalan 3,taman permata,lorong mentari,32333,0405AUC2010007436,Puan Nur Faizati,Penolong Pegawai Tanah Lelong (PTD),Seremban,08 DISEMBER 2010,27 JANUARI 2011,Thursday ,02:00 ,pagi,A,PTG MELAKA,,,Ali Bin Abudillah,,RM234,,,24 MEI 2011,10 FEBRUARI 2011,Mukim Jimah,Lot,0009838,HSD,22923
    KOD_NEGERI_NAMA,ID_HAKMILIK,PENYERAH_NAMA,PENYERAH_ALAMAT1,PENYERAH_ALAMAT2,PENYERAH_ALAMAT3,PENYERAH_ALAMAT4,PENYERAH_POSKOD,PENYERAH_KOD_NEGERI,PENYERAH_NO_RUJ,ID_MOHON,KOD_HAKMILIK,NO_HAKMILIK,NAMA,NO_LOT,NAMA_1,NAMA_2,TMPT,DIMASUK,NAMA_3,ALAMAT1,VEN,ALAMAT2,ALAMAT3,ALAMAT4,POSKOD,ID_MOHON_1,PGUNA_NAMA,JAWATAN,KOD_DAERAH_NAMA,TRH_ENKUIRI,TRH_LE,DAY,HOUR,NOON,CARA_LELONG,TMPT_1,HARGA_RIZAB,HARGA_RIZAB_1,PIHAK_NAMA,ER,'RM'||ENKUIRI.TUNGGAK_AMAUN,DEPOSIT,CONVERTED_FORM,TRH_AKHIR_BYR,SYSD,KOD_BPM_NAMA,KOD_LOT_NAMA,NO_LOT_1,KOD_HAKMILIK_1,NO_HAKMILIK_1
    Johor,050503PM00000151,HAMZAH DAUD DAROS & SITI NOR,NO 12 1ST FLOOR & 2ND FLOOR,JLN SRI RAHANG,TMN SRI RAHANG,SEREMBAN,58000,05,12345,0405AUC2010007436,PM and HSD,151 and 22923,Lot,6309,Mukim Lenggeng,Seremban,PTG MELAKA,pptlelong1,Puan Nur Faizati,ASDFSAF,AHMAD,DSFDS,FDSFSDF,DSFSDF,12345,0405AUC2010007436,Puan Nur Faizati,Penolong Pegawai Tanah Lelong (PTD),Seremban,08 DISEMBER 2010,27 JANUARI 2011,Thursday ,02:00 ,pagi,A,PTG MELAKA,,,Ahmad,,RM234,,,24 MEI 2011,10 FEBRUARI 2011,Mukim Lenggeng,Lot,6309,PM,151
    that means i need to list aggregate the two rows into one how to make the changes for the above query in order to do so .
    Edited by: user9093689 on Feb 9, 2011 10:03 PM

    user9093689 wrote:
    now need to bother abt this that line converts date into malay language
    to_char(enkuiri.TRH_enkuiri,'DD')||' '|| to_char(enkuiri.TRH_enkuiri,'MONTH','nls_date_language=malay') ||' '||TO_CHAR (enkuiri.TRH_enkuiri, 'YYYY') trh_enkuiri,iam retriving two rows of output, wat i need is to display one row and the second row values which are not similar should be added to the first row
    for example for column
    kod_hakmilik two rows values are
    PM
    HSD
    but they should be display as
    PM and HSD
    finally my aim is to retrieve only one row as output.
    i dont how exactly the term listaggr . how ever it may be whether using groupby or any other but the output should be as aboveWhat version of Oracle are you on?
    Look up the LISTAGG() function in the documentation for your version (assuming it is there) and see if it can do what you want

  • A way to roll up rows into one row

    Is there a way to "roll up" a set number of rows into one row? I would like to have a row that can be expanded into several rows by clicking a plus sign or something similar. Anyway to do this?
    Regards,
    Mark

    Mark,
    Sorry, it didn't occur to me that you meant "hiding". It sounds like you already know how to hide and unhide but unfortunately there are no shortcuts. I agree that it would be nice to have a way to unhide a selected row or column and if my memory serves me I submitted a request for this feature some months ago. May I suggest that you also go to Main Menu > Numbers > Provide Numbers Feedback.
    The more requests for features they receive the better the chance for getting them in future updates. Best wishes,
    pw

  • I have several pics of my new grandson throughout the year.  How do I combine them into one event

    I have several pics of my new grandson throughout the year.  How do I combine them into one event

    You can drag and drop photos from one Event to another. Or you can flag them and use the Events: Add Flagged photos to Select Event.
    However, why not use an Album for the job?

Maybe you are looking for

  • Separate calculation of service tax & VAT in PO itself

    Hi ., My client wants to configure the following scenario without changing  tax procedure( TAXINN) While creating a PO for Rs. 100 then on Rs. 30 there should be a calculation of VAT and on Rs. 70 there should be a calculation of Service tax. Please

  • Assign Photo to Contact Bugs!

    It seems that with each upgrade the feature that allows you to assign a photo to a contact keeps changing the way it works. When I select a photo and use the cropping tools, the results are not even close to what you see on screen with the crop and z

  • Troubles with usb 3

    I've bought a sound inteface but it doesent work with USB 3 of my MacBook Air Lion 10.7.5. Any help

  • How to call LabVIEW from TestDirector

    Hai to all, I want to call LabVIEW function from TestDirector. That TestDirector using VBScript. is it posible? if posible can you give the procedure. thanks for advance! reddy

  • How can I get iOS other than 5.1.1 on an original iPad?

    I can't open some apps because they require newer than iOS 5.1.1. My original iPad will not let me update any further. Help...