About table join
i have 2 tables in my report.
table A: group-id, item-id, name, ...
table B: group-id, item-id, detail-id, name, ...
i want to join the 2 table using group-id & item-id.
i tried but the join result is not correct, it looks like only joint on 1 column.
does crystal report support this kind of join?
how can i define the joint condition:
- tableA.group-id = tableB.group-id and tableA.item-id = tableB.item-id
- tableA.group-id = tableB.group-id or tableA.item-id = tableB.item-id
it seems there is no way to specify the "and", "or".
thanks in advance
Hello,
Yes CR should allow this unless the DB driver you are using does not support it.
Older DB drivers may not support mutliple joins.
I assume also that you are dragging the field from Table A to Table B and then right clicking on the link and selecting the join type?
What DB are you using and how are you connecting, ODBC, OLE DB, native or ????
What you can do is create the SQL outside of CR and then as a test use a Command and paste in your SQL. If this works then you should be able to do the same in the database expert Linking options.
Thank you
Don
Edited by: Don Williams on Sep 23, 2009 7:26 AM
Similar Messages
-
Strange behaviour of view based on several tables join with union all
Dear fellows we r facing a strange problem we have a view based on several tables joined by union all ,when we issue an ordered query on date,rows returned are unusually different than they should be .
Is oracle has some special behaviour for view based on union all ?
I m using oracle 8.1.6 on windows 2000
Kashif SohailDid you ever solve this problem? I have two select statements based on 4 tables and 3 views using about 5 more tables. When I execute each select individually I get exactly what is expected. When I UNION ALL both selects together, I get "no rows returned", however when I UNION them I get exactly what is expected. I should get the same answer for both UNION ALL and UNION. The two select statements are identical, except for one column where I changed the constant to be different. Any thoughts?
-
hi
i am new to sap , i dont no about inner join in abap coding
plz send me some notes or coding.
thank u.
your regrads
divya.hi
use this links
INNER JOIN and OUTER JOINhttp://help.sap.com/erp2005_ehp_03/helpdata/EN/cf/21ec77446011d189700000e8322d00/frameset.htm
JOINED TABLES
http://help.sap.com/erp2005_ehp_03/helpdata/EN/0f/49bd6a5d5049edba7b3afe6c7956e3/frameset.htm
u will find all thins related to joins with example and how to use it
Cheers
Snehi
Edited by: snehi chouhan on Jul 25, 2008 9:45 AM -
Need your help to confirm the table join rules on DocEntry and DocNum.
Hi guys,
I've done some study and awared table join rules on SBO documents, let me put in the followings:
(1) the table of documents head (i.e. ODLN) and line items (i.e. DLN1) can be joined via DocEntry/BaseEntry.
(2) the table of related documents (i.e. RDR1 and DLN1) can be joined via DocNum/BaseRef.
finnally, can we say that we can ONLY join table by DocEntry/BaseEntry or DocNum/BaseRef, and we should NOT use DocEntry/BaseRef.
Am I right? pls help to correct it for my misunderstanding.
Thanks.thanks for your help.
but I'm truly confused about why some table have both BaseRef and BaseEntry columns, some table only have DocEntry columns?
As I know, e.g. OWOR and WOR1, there have some series generated from NMM1, the value of DocEntry/DocNum in OWOR may not be the same, and we can only join OWOR/WOR1 via OWOR.DocEntry = WOR1.DocEntry.
So when to use (T0.DocEntry/T1.DocEntry), when to use (T0.DocEntry/T1.BaseEntry) and when to use (T0.DocNum/T1.BaseRef)? -
When I'm seeing an article about cross join I got a doubt. In that physical diagram they connected the the column-1 from table A and column 2 from table B.Table-A is xls and table-2 is Oracle.
Now IN BMM layer they connected the col-1 and col-2 as foreign key join. I think In BMM layer we prefer to do complex join. Any idea to get an idea
Thanks & Regards,
PallisHi Pallis,
Check my blog regarding joins; http://obibb.wordpress.com/2010/08/06/joins-in-oracle-bi-ee/
From Answers a Logical query is fired. The BI Server fires two Physical queries to the seperate databases. The results of the two seperate queries are stiched toghether by the BI Server and presented in Answers.
Cheers,
Daan Bakboord
http://obibb.wordpress.com -
Order Query in SQ01 using Table Joins in CRM
Hello Experts,
I am trying to create a query using table joins in SQ01 in CRM because I need a report that will give me all transactions for a selected Business Partner. I am unable to display any results when running my query. I have found other threads which give a list of possible tables to join together, but the fields used in the joins were not described.
The tables I have joined in my query are as follows:
CRMD_ORDERADM_H
CRMD_ORDER_INDEX
CRMD_PARTNER
BUT_000
I have used SE16 to try to search for additional tables to use for linking the Business Partner with a transaction, but I have been unsuccessful.
Would anyone please give advice as how to proceed?
Reward points are available!
Thank you in advance,
DavidDavid
The link with be the GUID.
CRMD_ORDERADM_H = Document Header Table
CRMD_ORDERADM_I = Document Line item Table
CRMD_LINK = Lists various link GUIDs, to
access order Information
The Table CRMD_ORDERADM_H will contain you transactions , once you find the GUID of your sales transaction in the table CRMD_ORDERADM_H.
You then need to check the table CRMD_LINK.
In this table you will then find a number in 11 = sales. This refers to the table CRMD_SALES. There are also links to many other tables ie Shipping, pricing, org etc.
CRMM_BUT_SET0140 - for Sales Group, Sales Office, District
CRMM_BUT_LNK0141 - for Sales Area data
Transaction CRMD_BUS2000115 allows you to see all sales transactions for a BP. CRMD_BUS2000126 shows you activities for selected BP.
Regards
M -
Context index can't be used in complicated multiple tables join?
hello
thank you for view this page.
i have a comlicated sql :
SELECT count(*)
from
((app_AssetBasicInfo left join app_AssetBasicInfoExt on
app_AssetBasicInfo.id=app_AssetBasicInfoExt.id) left join
(app_AssetCustominfo1 left join app_AssetCustominfoExt1 on
app_AssetCustominfo1.id=app_AssetCustominfoExt1.id) on
app_AssetBasicInfo.id=app_AssetCustominfo1.id) WHERE
app_AssetBasicInfo.CategoryID=1 AND Del_tag=0 and contains(description,'department')>0;
the table app_AssetBasicInfo and app_AssetBasicInfoExt have multiple columns and large recoord size. i create a context index on app_assetbasicinfoext(description) which description is 4000 varchar2.
but the sql doesn't use context index. i suspect that the complicated multiple table join can't use context index? does it correct?
thanks very much!Could you please post an explain plan? I'm not quite sure what is the issue.
-
1. How to create an explain plan with rowsource statistics for a complex query that include multiple table joins ?
When multiple tables are involved , and the actual number of rows returned is more than what the explain plan tells. How can I find out what change is needed in the stat plan ?
2. Does rowsource statistics gives some kind of understanding of Extended stats ?You can get Row Source Statistics only *after* the SQL has been executed. An Explain Plan midway cannot give you row source statistics.
To get row source statistics either set STATISTICS_LEVEL='ALL' in the session that executes theSQL OR use the Hint "gather_plan_statistics" in the SQL being executed.
Then use dbms_xplan.display_cursor
Hemant K Chitale -
Hi,
I built a query with 4 tables inside (load from Oracle DB and two of them are quite big, more than millions of rows). After filtering, I tried to build relationships between tables using Table.Join formula. However, the process took extremly long time to
bring out results (I ended the process after 15 mins' processing). There's a status bar kept updating while the query was processing, which is showed as . I suppose
this is because the query folding didn't working, so PQ had to load all the data to local memory first then do the opertion, instead of doing all the work on the source system side. Am I right? If yes, is there any ways to solve this issue?
Thanks.
Regards,
QilongHi Curt,
Here's the query that I'm refering,
let
Source = Oracle.Database("reporting"),
AOLOT_HISTS = Source{[Schema="GEN",Item="MVIEW$_AOLOT_HISTS"]}[Data],
WORK_WEEK = Source{[Schema="GEN",Item="WORK_WEEK"]}[Data],
DEVICES = Source{[Schema="GEN",Item="MVIEW$_DEVICES"]}[Data],
AO_LOTS = Source{[Schema="GEN",Item="MVIEW$_AO_LOTS"]}[Data],
Filter_WorkWeek = Table.SelectRows(WORK_WEEK, each ([WRWK_YEAR] = 2015) and (([WORK_WEEK] = 1) or ([WORK_WEEK] = 2) or ([WORK_WEEK] = 3))),
Filter_AlotHists = Table.SelectRows(AOLOT_HISTS, each ([STEP_NAME] = "BAKE" or [STEP_NAME] = "COLD TEST-IFLEX" or [STEP_NAME] = "COLD TEST-MFLEX") and ([OUT_QUANTITY] <> 0)),
#"Added Custom" = Table.AddColumn(Filter_AlotHists, "Custom", each Table.SelectRows(Filter_WorkWeek, (table2Row) => [PROCESS_END_TIME] >= table2Row[WRWK_START_DATE] and [PROCESS_END_TIME] <= table2Row[WRWK_END_DATE])),
#"Expand Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"WRWK_YEAR", "WORK_WEEK", "WRWK_START_DATE", "WRWK_END_DATE"}, {"WRWK_YEAR", "WORK_WEEK",
"WRWK_START_DATE", "WRWK_END_DATE"}),
Filter_AolotHists_byWeek = Table.SelectRows(#"Expand Custom", each ([WORK_WEEK] <> null)),
SelectColumns_AolotHists = Table.SelectColumns(Filter_AolotHists_byWeek,{"ALOT_NUMBER", "STEP_NAME", "PROCESS_START_TIME", "PROCESS_END_TIME", "START_QUANTITY", "OUT_QUANTITY", "REJECT_QUANTITY",
"WRWK_FISCAL_YEAR", "WRWK_WORK_WEEK_NO"}),
Filter_Devices= Table.SelectRows(DEVICES, each ([DEPARTMENT] = "TEST1")),
SelectColumns_Devices = Table.SelectColumns(Filter_Devices,{"DEVC_NUMBER", "PCKG_CODE"}),
Filter_AoLots = Table.SelectRows(AO_LOTS, each Text.Contains([DEVC_NUMBER], "MC09XS3400AFK") or Text.Contains([DEVC_NUMBER], "MC09XS3400AFKR2") or Text.Contains([DEVC_NUMBER], "MC10XS3412CHFK") or Text.Contains([DEVC_NUMBER],
"MC10XS3412CHFKR2")),
SelectColumns_AoLots = Table.SelectColumns(Filter_AoLots,{"ALOT_NUMBER", "DEVC_NUMBER", "TRACECODE", "WAFERLOTNUMBER"}),
TableJoin = Table.Join(SelectColumns_AolotHists, "ALOT_NUMBER", Table.PrefixColumns(SelectColumns_AoLots, "AoLots"), "AoLots.ALOT_NUMBER"),
TableJoin1 = Table.Join(TableJoin, "AoLots.DEVC_NUMBER", Table.PrefixColumns(SelectColumns_Devices, "Devices"), "Devices.DEVC_NUMBER")
in
TableJoin1
Could you please give me some hints why it needs so long to process?
Thanks. -
How to build table join query in Jdeveloper
Hi,
Can someone tell me how to build table join query in Jdeveloper's Expression Builder UI?[Is it possible to create a table of contents in Crystal Reports?|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233313335333133303330%7D.do]
-
3 Table Join with group by and order by clauses
I am porting from MySQL to Oracle 8i. I have a three Table Join in MySQL as follows:
select distinct TO_DAYS(l.listend)-TO_DAYS(NOW()) AS daysLeft, i.minbid, l.listend, i.itemid, i.itemtitle, l.listingid, l.lendstart, l.lendend, l.status, MAX(b.amount) AS curBid, COUNT(b.amount) AS numBids from TBL_ITEMS i, TBL_LISTING l LEFT JOIN TBL_BIDS b ON l.listingid=b.listingid where i.itemid = l.itemid AND l.status='1' AND (TO_DAYS(l.listend)-TO_DAYS(NOW()) >= 0) AND i.catcode LIKE'12__' GROUP BY listingid order by curBid DESC, daysLeft;
It performs an straight join on the first 2 tables (TBL_ITEMS and TBL_LISTING) and a LEFT JOIN between the previous result set and TBL_BIDS. TBL_BIDS uses a group by clause to obtain MAX and COUNT info. This final result set is the sorted (ORDER BY).
I have tried to reconstruct this type of call in Oracle and have failed. Several problems that I have notices: Oracle does not let me pull in additional columns when doing a GROUP BY clause.
(see below for my work around)
I have worked around the problem by creating a TABLE with the group by functionality and doing a straing 3 table join. (NOTE: I cannot create a view because use a LIKE function in the call... view dont have indexes). However, when I try to alias the column that returns DATE subtraction ("l.listend-TRUNC(SYSDATE) daysLeft" OR "l.listend-TRUNC(SYSDATE) dayLeft") I cannot use the LIKE statement.
Here is my question. How do I port the above 3-table MySQL call to Oracle. Why am I having these problems (is it the Oracle optimizer?) and how do I avaopid them in the future.
I really appreciate anyone's input. Thanks,
Inder
WORK AROUND:
FIRST STEP:
"create TABLE BIDSUM as
select l.listingid, COUNT(b.amount) numBids, MAX(b.amount) curBid from TBL_LISTING l, TBL_BIDS b where l.listingid=b.listingid(+) group by (l.listingid);"
NEXT STEP:
select i.minbid, i.itemtitle, l.lendstart-TRUNC(SYSDATE), l.lendend, l.listingid, l.status, s.numbids, s.curbid from TBL_ITEMS i, TBL_LISTING l, BIDSUM s where l.listingid=s.listingid AND i.itemid=l.itemid AND l.status='1' AND i.catcode LIKE '12%';
THIS ALSO WORKS (no LIKE):
"select i.minbid, i.itemtitle, l.lendstart-TRUNC(SYSDATE) daysLeft, l.lendend, l.listingid, l.status, s.numbids, s.curbid from TBL_ITEMS i, TBL_LISTING l, BIDSUM s where l.listingid=s.listingid AND i.itemid=l.itemid AND l.status='1' AND i.catcode='12'";
BUT THIS DOES NOT (alias the DATE arimetic)
select i.minbid, i.itemtitle, l.lendstart-TRUNC(SYSDATE) daysLeft, l.lendend, l.listingid, l.status, s.numbids, s.curbid from TBL_ITEMS i, TBL_LISTING l, BIDSUM s where l.listingid=s.listingid AND i.itemid=l.itemid AND l.status='1' AND i.catcode LIKE '12__';I am porting from MySQL to Oracle 8i. I have a three Table Join in MySQL as follows:
select distinct TO_DAYS(l.listend)-TO_DAYS(NOW()) AS daysLeft, i.minbid, l.listend, i.itemid, i.itemtitle, l.listingid, l.lendstart, l.lendend, l.status, MAX(b.amount) AS curBid, COUNT(b.amount) AS numBids from TBL_ITEMS i, TBL_LISTING l LEFT JOIN TBL_BIDS b ON l.listingid=b.listingid where i.itemid = l.itemid AND l.status='1' AND (TO_DAYS(l.listend)-TO_DAYS(NOW()) >= 0) AND i.catcode LIKE'12__' GROUP BY listingid order by curBid DESC, daysLeft;
It performs an straight join on the first 2 tables (TBL_ITEMS and TBL_LISTING) and a LEFT JOIN between the previous result set and TBL_BIDS. TBL_BIDS uses a group by clause to obtain MAX and COUNT info. This final result set is the sorted (ORDER BY).
I have tried to reconstruct this type of call in Oracle and have failed. Several problems that I have notices: Oracle does not let me pull in additional columns when doing a GROUP BY clause.
(see below for my work around)
I have worked around the problem by creating a TABLE with the group by functionality and doing a straing 3 table join. (NOTE: I cannot create a view because use a LIKE function in the call... view dont have indexes). However, when I try to alias the column that returns DATE subtraction ("l.listend-TRUNC(SYSDATE) daysLeft" OR "l.listend-TRUNC(SYSDATE) dayLeft") I cannot use the LIKE statement.
Here is my question. How do I port the above 3-table MySQL call to Oracle. Why am I having these problems (is it the Oracle optimizer?) and how do I avaopid them in the future.
I really appreciate anyone's input. Thanks,
Inder
WORK AROUND:
FIRST STEP:
"create TABLE BIDSUM as
select l.listingid, COUNT(b.amount) numBids, MAX(b.amount) curBid from TBL_LISTING l, TBL_BIDS b where l.listingid=b.listingid(+) group by (l.listingid);"
NEXT STEP:
select i.minbid, i.itemtitle, l.lendstart-TRUNC(SYSDATE), l.lendend, l.listingid, l.status, s.numbids, s.curbid from TBL_ITEMS i, TBL_LISTING l, BIDSUM s where l.listingid=s.listingid AND i.itemid=l.itemid AND l.status='1' AND i.catcode LIKE '12%';
THIS ALSO WORKS (no LIKE):
"select i.minbid, i.itemtitle, l.lendstart-TRUNC(SYSDATE) daysLeft, l.lendend, l.listingid, l.status, s.numbids, s.curbid from TBL_ITEMS i, TBL_LISTING l, BIDSUM s where l.listingid=s.listingid AND i.itemid=l.itemid AND l.status='1' AND i.catcode='12'";
BUT THIS DOES NOT (alias the DATE arimetic)
select i.minbid, i.itemtitle, l.lendstart-TRUNC(SYSDATE) daysLeft, l.lendend, l.listingid, l.status, s.numbids, s.curbid from TBL_ITEMS i, TBL_LISTING l, BIDSUM s where l.listingid=s.listingid AND i.itemid=l.itemid AND l.status='1' AND i.catcode LIKE '12__'; -
How expensive is remote db table join?
In performance tuning a sql statement, I have a query join a local table to two remote tables, it took 9 sec to return 6000+ rows. If I copy the two remote tables to local db, it took 700 msec. All joins/indexes are identical. The remote db is in the same box as the local db.I am only asking for general opinion for experience on remote db table join. From explain plan, I already know it's doing next loop index join on the primary key on the two remote db tables. Only one coluum needed from each remote table. Does it look unusual expensive for 6000 primary key join to remote db tables?. 4 sec for each remote table, added up to 8 sec. The rest of processing is minimal.
-
Table join and Logical databasein a same query
Hi Experts,
I have an existing query which is created using table join. I now want to add a logical database in the same infoset.
Is it possible to add a logical database in the same infoset?
Regards,
PrakharHi Prakhar,
If you see the below scren, you can use data source either Table join using basis table or Logical database.
but if you need ldb with some addition table field then you can data retrieval by program step or you can use LDB with doing some code in inside your infoset.
Regards,
Prasenjit -
HR: Info about Table T77ZZ
Hi ,
Can anyone give me some idea about table T77ZZ ?
Like why it is used,when it is updated etc.
Thanks very much.
Regards,
Sandip.
Ph: +44 121 683 2561.hi,
check this it may help you....
https://websmp106.sap-ag.de/~form/sapnet?_FRAME=CONTAINER&_OBJECT=012006153200000167822005
https://websmp106.sap-ag.de/~form/sapnet?_FRAME=CONTAINER&_OBJECT=011000358700008971712001
regards,
venu. -
About table display functionalities
Hi all,
I have to deal with one question about table display :
- I'd like to remove the orange color when we select a row. I tried to change the selectionChangeBehaviour properties but it only freeze the colored row to the first position.
Does someone has an idea?
Thank you.
RegardsHi,
If we set selectionMode property to none then it disables the lead selection. Try it once that whether it meets your requirement.
Regards,
Siva
Maybe you are looking for
-
If you do a search on the web, you will discover that I am far from the only one who finds that she cannot use Firefox because it is incompatible with Windows 7 64 bit. I'm pretty sure there must be hundreds of thousands of users out there that can n
-
Calibrating my monitor wigh 10.2.8
I have been trying to calibrate my monitor using my old coal-fired OS of 10.2.8. I go through the steps under the "Display" memu in the system profile. I get finished and save the profile under a new name. However I can not get the new profile to tak
-
My password was flagged as disabled this weekend. Reconfirmed this morning, then tried to update to latest iTunes. Didn't complete update (got error 7, Windows error 126). Tried a second time; still no luck. Tried complete download from Apple web
-
Import eps created in inkscape (cairo)
Hello, I have an eps created in Inkscape. I have the following issue: Illustrator opens it without an error, but it rasterizes the gradient. It is a non transparent gradient, from red to blue, a bit oblique. Weirdly, the eps is opened back fine in In
-
When I try to save a file to an existing folder, the folder icons are there, but no folder names. I have to manually click on each one to find the folder I'm looking for. I've had this issue for months. Any suggestions?