Join set of two rows into one
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.
Thanks
Hi,
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
Similar Messages
-
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 PMuser9093689 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 -
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 -
Combining result set of two services into one result set
Hi,
I have a model where I am getting one result set (6 Fields) from BI query and another result set (3 Fields which gives real time values) from OLTP system. I want to show the output of these two result sets into single result set (7 Fields). I have a common field in both the result sets as key field.
I tried this using UNION operator but I am not able to set the Key fields and also in the table view of UNION operator I am getting any field to be added to table.
Can anyone help me to solve this problem?
Any help is appreciated.
Regards,
AmitHi Amit,
in this case, you have to use the combine-operator. However, this operator needs a key-field in each of these sets. E.g. Combine set (<u>customer-id</u>, order-id, week, delivery-state) with set (<u>customer-id</u>, city, client-class).
The combine operator might not be available when compiling to webdynpro, I did not check that.
Best Regards, Benni -
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,
MarkMark,
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 -
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]
-
Join two ODS into one cube!
Hello Experts -
I need to join fields of 2 ODS into one cube. I know the common field. We are in BI 7.0.
Can someone guide me through the steps?
I know there are two transformation rules. And I have created them. How do I link them so that I have one record when the common field matches?Syed!!!
What your are trying is very complicated, if you want to do infoset that even worst, not only data wise, but only performance. If you are planning to get key figure only from one ods and only characteristics coming from different ods, infoset might work as long as you know the relationship (one-to-one relationship will work fine in infoset). Performance wise, MP is very good, but the question again, you will get multiple lines unlike infoset.
So before, someone decided to use infoset, MP or even some other data model, they need to know well the reporting requirement and well divers in the relationship of the ods.
I have faced the same situation in many of my projects, there are places I used infoset and MP, and also created a different infoobject as a master data and turned the attributes as NAV. Attribute.
Thanks.
Wond -
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. -
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
RayYou 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 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 DOr 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 -
Combining two tables into one result
Hi all, I am fairly inexperienced with Crystal but have gained good results from the reports I have created, I am fluent in SQL and Basic to an extent. I am interigating a Pronto database and I want concatenate two tables into one report.
Table One: Customer Orders
Fields: Customer No, Invoice Number, Invoice date, Invoice Amount, Cost Amount.
Table Two: Archived Customer Orders
Fields: Customer No, Invoice Number, Invoice date, Invoice Amount, Cost Amount.
I want to complete a report that will tell me the sales for a given period and the outstanding orders for each customer total for all fields in each table combined into one figure.
Any help would be greatly appreciated.
Thanks in advanceHi Grant,
As you said you are goot at writing SQL, in Crystal write a SQL statement in Add Command to join both table using Union / Union all
If you use Union then it will filter duplicate records and pull the data from database, If you use Union All then it will include all your duplicate records. Please use Union / Union All as required.
Once you get all data into the report create a parameter for date range and generate the summaries as required.
Thanks,
Sastry -
How can update two rows in one query?
How can update two rows in one query?
Edited by: OracleM on May 4, 2009 12:16 AMWhat do you mean with "two rows"? May be two columns??
If the where clause of UPDATE query matches two rows, then it will update two rows. If you want to update two columns, then add column names to your query
UPDATE your_table SET col1=value1, col2=value2 WHERE your_where_clause- - - - - - - - - - - - - - - - - - - - -
Kamran Agayev A. (10g OCP)
http://kamranagayev.wordpress.com
[Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/]
Maybe you are looking for
-
How to tell my Mac that Windows can be booted?
Hey! Hello again. I have found myself in a very stressing situation: I can`t boot windows. Windows can't be recognized as an OS right now. I got a windows partition using bootcamp and I was happy with it for almost a year, but recently(the last week)
-
I have created a ZTABLE- having amount field and currency/qunatity field as WAERS and tcurc as reference table. Created a structure where i created zwaers as field and currency and quantity fields as ZWAERS and my structure name as reference table--i
-
Read the valid Operation/Activity Master Recipe data using an FM
Dear all, Can anyone guide me to a function module, which could read the relevant master recipe data taking the validity date into consideration. i.e. the function module should return the correct valid data based on the Key Date. Is there such a fun
-
How to place grouped items into another object with content collector tool?
Is it possible to paste a group into another object (i.e. frame) by using the Content Collector Tool while linking the content? Paste Into is either deselected or possibly whatever was last saved to the clipboard ends up inserting. I was able to pla
-
Separate 2 libraries in 1 account
Hi there, I have one account, with which I buy music for me and my partner, I have set up 2 libraries one each. The trouble I am having is that even though I have these 2 libraries, itunes will not separate the media, ie. I don't care for tina turner