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
Similar Messages
-
HI,
Would you help me to write aquery such that merges two data into one,
for example,
Take a table Student
Its content are
Roll no Name
1 Rahul
2 Shyam
We reqiure a query such that we get out put as
Rahul;Shyamhttp://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
-
Concatenate two rows into one drop down? Not order them though
Ok I have two rows:
Group
Original Performance NorGrip
Gold Blank Disc
Gold Blank Disc
Truckbed Liner Kit
Then I have another one:
Attribute
Grade
Grade
Dimensions
However, I don't want them combined on top of one another.
I want it so a person can select like so:
Original Performance NorGrip Grade
Gold Blank Disc Grade
Gold Blank Disc Dimensions
Truckbed Liner Kit (no value in the other column)
The truckbed liner kit has no attribute value in the column so I would rather the option not show at all... So as long as the attribute column is filed, combine the two and show it in a validation list..
I know how to create lists and then make them validation lists, but this is stumping me..From your example and description, I'm not sure I understand what you are starting with. Do you have a grid (group, etc across the top; attribute etc in rows, with som marker that shows which combinations are valid and which arent? Or do you have two rows
(or columns) that /only/ contain the valid combinations?
If you have them in two rows (or columns) containing only the valid combinations, then you can insert a third row (or column) as a helper column and just concatenate the two values, like A3 =A1 & " " & A2
Then either use that range to feed your validation list on the same page, or turn it into a named range and feed a validation list on another sheet. -
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
imranSQL> 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 combine data from two rows into one row
I have the following sets of data. I want to find all the duplicate sets of field values. in the data below there is only one duplicate set: brenda, analyst, green.
DocID and Doc Seq combine to form the set key. FieldID I believe are consistent in that 1 is always name, 2 is job, 3 is favorite color etc. but there are up to 20 field IDs.
To tell you the truth, my client is a bit sketchy about the data and the values. I would like collapse the sets by getting all the field values into a single row. They could be in the same column, or in their own columns. This way I can then look for whatever
dups my customer seems to think that he has.
the first image is what i want (either in same column or in different columns. but they have to be in the order of the FieldID), the second is what i have. THANKSCREATE TABLE #t (
c1 INT NOT NULL PRIMARY KEY,
c2 VARCHAR(50) NOT NULL
GO
INSERT INTO #t(c1, c2) VALUES(1, 'P1,P2,P3')
INSERT INTO #t(c1, c2) VALUES(2, 'P2,P3')
GO
-- Generate set of numbers
-- Idea from Itzik Ben-Gan
;WITH
L0 AS (SELECT 1 AS n UNION ALL SELECT 1),
L1 AS (SELECT 1 AS n FROM L0 AS a, L0 AS b),
L2 AS (SELECT 1 AS n FROM L1 AS a, L1 AS b),
L3 AS (SELECT 1 AS n FROM L2 AS a, L2 AS b),
L4 AS (SELECT 1 AS n FROM L3 AS a, L3 AS b),
Numbers AS (SELECT ROW_NUMBER() OVER(ORDER BY (SELECT 1)) AS Number FROM L4)
SELECT
t.c1,
t.c2,
SUBSTRING(',' + t.c2 + ',', Number + 1, CHARINDEX(',', ',' + t.c2 + ',',
Number + 1) - Number - 1) AS Item,
ROW_NUMBER() OVER(PARTITION BY t.c1 ORDER BY n.Number) AS rn
FROM
#t AS t, Numbers AS n
WHERE
n.Number <= LEN(t.c2)
AND SUBSTRING(',' + t.c2 + ',', n.Number, 1) = ','
ORDER BY
t.c1, rn
GO
DROP TABLE #t
GO
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Hello all,
I have a table with 1 column and records are as below. Below I am showing only the first 4 records to give an idea.
select cn from CSGL_AD_GROUP_OP_COMP_MEM_TEMP where rownum<5;
CN
CN=JZJXEEW00072305,OU=Desktops,OU=Secured_Systems,OU=Computers,OU=ZJX_ARTCC,OU
=FL,OU=ESA,OU=ATO,OU=LOB,DC=faa,DC=gov
CN=JI90NTW00069990,OU=Desktops,OU=Secured_Systems,OU=Computers,OU=I90_TRACO,OU
=TX,OU=CSA,OU=ATO,OU=LOB,DC=faa,DC=gov
Now the requirement is to concatenate 1st and 2nd row, next concat 3rd and 4th row, next conact 5th and 6th row and so on and put it into a new column in the same table if its possible, if not into a new table.
How do I do this, can somebody help me.
ThanksHi,
To start it would be nice if your create table statement is using the same name (CSGL_AD_GROUP_OP_COMP_MEM) as the insert statements (CSGL_AD_GROUP_OP_COMP_MEM2)
with
select * from CSGL_AD_GROUP_OP_COMP_MEM;
KEY CN
1 CN=JZJXEEW00072305,OU=Desktops,OU=Secured_Systems,OU=Computers,OU=ZJX_ARTCC,OU
2 =FL,OU=ESA,OU=ATO,OU=LOB,DC=faa,DC=gov
3 CN=JI90NTW00069990,OU=Desktops,OU=Secured_Systems,OU=Computers,OU=I90_TRACO,OU
4 =TX,OU=CSA,OU=ATO,OU=LOB,DC=faa,DC=gov
5 CN=JADQTTW00070657,OU=Desktops,OU=Secured_Systems,OU=Computers,OU=ADQ_FCT,OU=A
6 K,OU=WSA,OU=ATO,OU=LOB,DC=faa,DC=gov
7 CN=JLIHKTW00071376,OU=Desktops,OU=Secured_Systems,OU=Computers,OU=LIH_FCT,OU=H
8 I,OU=WSA,OU=ATO,OU=LOB,DC=faa,DC=gov
9 CN=JSLCTTW00073172,OU=Desktops,OU=Secured_Systems,OU=Computers,OU=SLC_ATCT,OU=
10 UT,OU=WSA,OU=ATO,OU=LOB,DC=faa,DC=gov
10 rows selectedYou sql should look like:
select
key
,cn
from
select
key
,cn || lead(cn) over (order by key) cn
,row_number() over(order by key)rn
from
CSGL_AD_GROUP_OP_COMP_MEM
where
mod( rn, 2)= 1
order by
key
KEY CN
1 CN=JZJXEEW00072305,OU=Desktops,OU=Secured_Systems,OU=Computers,OU=ZJX_ARTCC,OU =FL,OU=ESA,OU=ATO,OU=LOB,DC=faa,DC=gov
3 CN=JI90NTW00069990,OU=Desktops,OU=Secured_Systems,OU=Computers,OU=I90_TRACO,OU =TX,OU=CSA,OU=ATO,OU=LOB,DC=faa,DC=gov
5 CN=JADQTTW00070657,OU=Desktops,OU=Secured_Systems,OU=Computers,OU=ADQ_FCT,OU=A K,OU=WSA,OU=ATO,OU=LOB,DC=faa,DC=gov
7 CN=JLIHKTW00071376,OU=Desktops,OU=Secured_Systems,OU=Computers,OU=LIH_FCT,OU=H I,OU=WSA,OU=ATO,OU=LOB,DC=faa,DC=gov
9 CN=JSLCTTW00073172,OU=Desktops,OU=Secured_Systems,OU=Computers,OU=SLC_ATCT,OU= UT,OU=WSA,OU=ATO,OU=LOB,DC=faa,DC=gov Regards,
Peter -
How to remove these icons in the red box, and Merge the two rows into 1?
1. How may one remove these icons in the red box?
2. How may one coalesce/merge the two bottom rows into one row?
I'm running a French version of Adobe Acrobat XI version 11.0.0.I'm working in AA9, but it may be the same.
The icons are in Tool Groups. The Groups are seperated by the verticle bars.
Right Click within a toolbar group to avail options for enabling and disabling tools within a Group.
The bars themselves can be selected with the mouse and dragged to re-order the groups. -
My girlfriend and I both have iTunes account with our own music libraries and we want to combine our two libraries into one icloude accounts so can both then access our one shared libary at anytime in the cloud. How do we do this?
No it is not possible. Content purchased from the iTunes Store is permanently tied to the account from which it was originally purchased, and Apple does not provide a way to change it.
-
HT1449 how do you move all music from two computers into one itunes account?
How do you move all music from two computers into one itunes account?
An "iTunes account" is an online account you use for buying music, like a bank account. An iTunes collection is the media you see when you open iTunes. Which do you mean?
If it is two computers, it would also help to know where these are located. Are they on the same local network? If they are, try Home Sharing (and you have control of both and you aren't just trying to get music fro your computer to your friend's computer in another state). If they are not, you'll have to use an external hard drive or flash drive.
Is this on a PC? Your computer information says Windows but you posted this in the iTunes for Mac forum. -
I opened an itunes account then forgot my password. I opened a new account now I would like to combine my two accounts into one but I still can't remember my password and now I have a new email account. Help!
You can't combine accounts but help here Apple ID FAQ's for resetting your Apple ID password.
-
How do I combine two regents into one in Logic Pro Arrange?
how do I combine two regents into one in Logic Pro Arrange?
Thanks for your input kcstudio. I would still be left with 2 regions although one after the other, on one track.
I am trying to save steps of the way I am combining the info of 2 seperate regions into one: bouncing the 2 tracks then re-importing that audio back into the project. It would save a lot of time if you could just drag one region on top of the other
W.W. -
Combining two messages into one
Hello,
I have a mapping issue, I have a business process in which I have to combine two messages into one.
To do so, I have defined a message mapping in which there are two source message types, and one target message type.
When testing the message mapping in the IR, it works fine, but when I define and test an interface mapping with that same message mapping, I receive this error message:
"Cannot produce target element /ns0:Messages/ns0Message1/MY_IDOC_TYPE/MY_SEGMENT. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd."
What am I doing wrong ?
How am I supposed to combine two messages into one ?
Thanks,
Elad.Hi Elad,
Just see if you have included both you source message interfaces and one target nessage interface correctly in while doing your interface mapping.....
The most common mistake made when we do scenarios which include combination of two source message types into one target type are:
- we forget to include both the source message interfaces.
- or we interchange between one of the source message interface with the target.
Just see if either of the 2 is aplicable in your case and just activate all components as and when you create them..
Regards,
abhy -
Is it possible to paste two images into one layer?
I'm having some issues pasting two images into one layer. Every time I paste the second image, it automatically creates a new layer...is there anyway to prevent that from happening? I'm making an animation on photoshop and I want there to be more than image in some of the frames. Please let me know if you have any suggestions! Thanks!
You can merge the two layers together once they're position. Select the top layer and choose merge down or select both and choose merge layers (from the layers menu).
http://help.adobe.com/en_US/Photoshop/11.0/WSfd1234e1c4b69f30ea53e41001031ab64-78b2a.html -
Collapsing two tables into one table or one queue
When you have data that exists in 2 tables A and B and B is essentially a child of A if you want to process these records such that you see all A's before their assoociated B how can you use either Streams or AQ to collapse these two tables into one? The data exists at it's source in database tables it will be replicated to another location and at that location I want to keep the data as it exists at the source but also process it in the ordered fashion I described above. My thinking is to publish the data to one queue but the challenge is to ensure that all A's are put on the queue before their B is. I don't just want a priority queue whereby all A's are processed before B's because if that happens B's will never be processed. but I simply want to avoid reading a B off the queue before I've read it's A.
No version number and no clarity of what you are trying to accomplish.
Without knowing that the problem is a nail ... I'd hardly be recommending using a hammer. -
Join the two JInternalFrame into one
hi everybody,
What can I do to join two JInternalFrame into one, like I have 2 floating panel then I join it into 1 by using JTappedPane. That you can drag to spit it out or join together !
thanks,
QuinI think you mean saving two images side-by-side into one image. You won't be able to this with a native iphone app, but you may find a third party app on the AppStore to do this. Try this http://itunes.apple.com/us/app/two-faces-photo-sharing/id406310161?mt=8 if you want more help, email me at [email protected]
Maybe you are looking for
-
So I was in the bathroom, cleaning my iPod case, and I accidentally dropped my unprotected iPod Touch from about two or three feet up. I picked it up and tried to turn it on, but it would not work. I freaked out and went to my charger in my room and
-
Exiting a Web Dynpro Application by pressing a button on a Web Dynpro View
Hi all, I want to exit a Web Dynpro application when the user presses an Exit button on the screen. Is there an API for closing the current browser window and exiting the application?Thanks. Sukru
-
Can anyone help?
-
PO Printing Status Indicator - Table
Hi Guys, We are developing one report for PO Printing Status. In which table PO Printing status updated after user Prints PO. Regards, Jackie
-
Hi, I am trying to call a plug-in in my existing java code. I have added the JAR to library. Basically, I need to establish connectivity to another server and insert data in that database. This is handled by a plug-in "BOPlgin.jar". I have imported t