Join the tables in the responses
I would like to know if it is possible to join the tables together as below in the answers?Select a.Field1, b.Field1
FROM tableA an outer join left tableA b on
a.Field1 = b.Field
If you want to make an INNER JOIN, and then type INNER JOIN instead of LEFT INNER JOIN.
If you want to left outer join and LEFT OUTER JOIN instead of INTERNAL LEFT JOIN type.
Nothing asked as a left inner join. That is why it gives error + [nQSError: 27002] near
Thank you
Tags: Business Intelligence
Similar Questions
-
Add the responsibility of the user through backend?
How can I join the responsibility of a user interface?
Is there a procedure that I can call?
Is there a table there that holds all the responsibilities I can look at?
Thank you!Hello
How can I join the responsibility of a user interface?
Is there a procedure that I can call?Use FND_USER_RESP_GROUPS_API. Insert_Assignment
Note: 373369.1 - how to assign and revoke the role and responsibility of a user using the standard API?
https://metalink2.Oracle.com/MetaLink/PLSQL/ml2_documents.showDocument?p_database_id=not&P_ID=373369.1Note: 459623.1 - how to create the FND user and the responsibility via the api?
https://metalink2.Oracle.com/MetaLink/PLSQL/ml2_documents.showDocument?p_database_id=not&P_ID=459623.1Is there a table there that holds all the responsibilities I can look at?
Query FND_USER_RESP_GROUPS_DIRECT
Note: 316455,1 - Fnd_user_resp_groups Table/view used in 11.5.10
https://metalink2.Oracle.com/MetaLink/PLSQL/ml2_documents.showDocument?p_database_id=not&P_ID=316455.1Kind regards
Hussein -
How to join two tables if you transpose the rows, columns and rows in one of the table
Hi guys,.
can someone help me please in the write request
I have two tables
Agents and Agent phones but in the agent phones table for the id of an agent it displays 4 rows because one of the column there types of different phones (office, mobile, home, fax)
So instead of display 4 rows, I used max(case...) to convert rows to columns
now how to reach it with another table
Requirement:
Database: 11.2.0.2.0
create the table AGENT_PHONE
(
agent_id NUMBER (20) not null,
agent_type_code VARCHAR2 (10) not null,
agent_type_prefix VARCHAR2 (10) not null,
Phone_Number VARCHAR2 (16) not null,
phone_type_code VARCHAR2 (10) not null
)
CREATE TABLEAGENTS
(
agent_id NUMBER (20) not null,
agent_type_code VARCHAR2 (10) not null,
agent_type_prefix VARCHAR2 (10) not null,
NAME VARCHAR2 (40) NOT NULL
)
INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)
VALUES (29709, ARE ', 'OFFICE', '4805551436', 'CELL');
INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)
VALUES (29709, ARE ', 'OFFICE', '1111111111', 'PHONE');
INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)
VALUES (29709, ARE ', 'OFFICE', '2223334444',' OFF');
INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)
VALUES (29709, ARE ', 'OFFICE', '5556667788', 'FAX');
INSERT INTO VALUES AGENTS
(29709, ARE ', 'OFFICE', 'FLY');
INSERT INTO VALUES AGENTS
(1234, ARE ', 'OFFICE', 'MIKE');
SELECT * FROM AGENT_PHONES
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX PHONE_NUMBER PHONE_TYPE_CODE ---------------------------------------------------------------------------------------------
29709 RE OFFICE 4805551436 CELL 29709 RE OFFICE 1111111111 PHONE 29709 RE OFFICE 2223334444 OFF 29709 RE OFFICE 5556667788 FAX
SELECT * AGENTS
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX NAME
29709 RE OFFICE ROB 1234 RE OFFICE MIKE
This is so the data we have in both table
Now, I transposed rows to columns in the table of agent phones so I used the following query
SELECT AP. AGENT_ID,. AGENT_TYPE_CODE,. AGENT_TYPE_PREFIX.
MAX (CASE WHEN AP. PHONE_TYPE_CODE = 'CELL' THEN AP. PHONE_NUMBER END) AS CELL.
MAX (CASE WHEN AP. PHONE_TYPE_CODE = 'OFF' THEN AP PHONE_NUMBER END) AS TURNED OFF.
MAX (CASE WHEN AP. PHONE_TYPE_CODE = 'FAX' THEN AP. PHONE_NUMBER END) LIKE FAX,.
MAX (CASE WHEN PHONE_TYPE_CODE = 'PHONE'. THEN AP PHONE_NUMBER END) AS PHONE
AGENT_PHONE AP
WHERE AP. AGENT_ID = 29709
GROUP OF AP. AGENT_ID, AP. AGENT_TYPE_CODE, AP. AGENT_TYPE_PREFIX.
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX CELL OFF FAX PHONE 1 29709 RE OFFICE 4805551436 2223334444 5556667788 1111111111 My question is how this to join the agents table so that my output should be like this...
I want to display all the results in the table of the Agent, even if they are not in the table of agent phones. As you can see there are other agent id 1234 is also populated
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX NAME AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX CELL PHONE OFF FAX --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
29709 RE OFFICE ROB 29709 RE OFFICE 4805551436 1111111111 2223334444 5556667788 1234 RE OFFICE MIKE Currently, I run this query and I get the output as below
SELECT *.
AGENTS HAS
LEFT OUTER JOIN AGENT_PHONE AP
ON A.AGENT_ID = AP. AGENT_ID
AND A.AGENT_TYPE_CODE = AGENT_TYPE_CODE.
AND A.AGENT_TYPE_PREFIX = AGENT_TYPE_PREFIX.
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX NAME AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX PHONE_NUMBER PHONE_TYPE_CODE 1 29709 RE OFFICE ROB 29709 RE OFFICE 4805551436 CELL 2 29709 RE OFFICE ROB 29709 RE OFFICE 1111111111 PHONE 3 29709 RE OFFICE ROB 29709 RE OFFICE 2223334444 OFF 4 29709 RE OFFICE ROB 29709 RE OFFICE 5556667788 FAX 5 1234 RE OFFICE MIKE I want id 29709 agent in a line with 1234 agent also id to display
You can rotate your phone number of agent in columns
Select *.
of AGENT_PHONE
pivot)
min (PHONE_NUMBER)
for PHONE_TYPE_CODE in ('CELL' as a 'CELL', 'PHONE' like 'PHONE', 'OFF' in the 'OFF', 'FAX' as 'FAX')
)
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX CELL PHONE OFF FAX 29709 RE OFFICE 4805551436 1111111111 2223334444 5556667788 Then you can join to view inline or CTE
with AGENT_PHONE_PIVOT like)
Select *.
of AGENT_PHONE
pivot)
min (PHONE_NUMBER)
for PHONE_TYPE_CODE in ('CELL' as a 'CELL', 'PHONE' like 'PHONE', 'OFF' in the 'OFF', 'FAX' as 'FAX')
)
)
SELECT *.
AGENTS HAS
LEFT OUTER JOIN AGENT_PHONE_PIVOT AP
ON A.AGENT_ID = AP. AGENT_ID
AND A.AGENT_TYPE_CODE = AGENT_TYPE_CODE.
AND A.AGENT_TYPE_PREFIX = AGENT_TYPE_PREFIX.
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX NAME AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX CELL PHONE OFF FAX 29709 RE OFFICE ROB 29709 RE OFFICE 4805551436 1111111111 2223334444 5556667788 1234 RE OFFICE MIKE - - - - - - - Is that what you're looking for?
-
Tuning for sql join key table no consumer of the heavy use of the query processor
Obligation comes to tunne prod of the query in
high use of the query processor
sql_id: fp79wb32h7a6t
Module: AHC, P_PatientDQ()
Cost: 7
Elapsed time: hung
Status: Hung, 35,253,460 day at 30 minute intervals
-Create table
create table ahc. PATIENTVISITS
(
ahcid NUMBER,
visitId NUMBER,
visitstatus NVARCHAR2 (100),
visitdate DATE,
visitintime DATE,
visitouttime DATE
)
-Create/recreate the index
create indexes ahc. F1_PATIENTVISIT_AHCID on ahc. PATIENTVISITS (AHCID, VISITID);
create indexes ahc. VISITDATE_IDX on ahc. PATIENTVISITS (TRUNC (VISITDATE));
First total number of table
Select count (1) of
Pvs AHC.patientvisits
-Save County 1387485
create table ahc. PATIENTDEPENDENTVISITS
(
ahcid NUMBER (19) not null,
IDPack NUMBER (10) not null,
visitId NUMBER (19) not null,
dependentvisitid NUMBER (19) not null,
isdiabetic NUMBER (2)
)
-Create/recreate the index
create indexes ahc. K1_PATIENTDEPENDENT_AHCID on ahc. PATIENTDEPENDENTVISITS (AHCID);
Total number of second table
Select count (1) of
AHC.patientdependentvisits POS
-Save County 774599
Original request:
SELECT count (*)
ACH. PVS PATIENTVISITS
WHERE PVS. VISITID IN (SELECT POS. DEPENDENTVISITID
ACH. PATIENTDEPENDENTVISITS POS
WHERE POS. AHCID = 37
AND POS. VISITID = 218
AND POS. ISDIABETIC = 0)
AND SUPERIOR (PVS. VISITSTATUS) = 'PENDING'
AND PVS. AHCID = 37
Count (1)
-----------
1
PL/sql Developer explain plan for the original query
Owner of description Objects_name cost cardin bytes cpucost cost of e/s
SELECT STATEMENT, GOAL = ALL_ROWS 7 1 41 63669 7 AGGREGATION OF TRI 1 41 SEMI OF THE NESTED LOOPS 7 1 41 63669 7 TABLE ACCESS BY INDEX ROWID AHC PATIENTVISITS 4 1 25 33295 4 INDEX RANGE SCAN AHC F1_PATIENTVISIT_AHCID 3 9 23164 3 TABLE ACCESS BY INDEX ROWID AHC PATIENTDEPENDENTVISITS 3 1 16 30375 3 INDEX RANGE SCAN AHC K1_PATIENTDEPENDENT_AHCID 2 14 18093 2 After editing the query
SELECT / * + FIRST_ROWS * / COUNT (1)
ACH. PVS PATIENTVISITS
JOIN THE AHC. PATIENTDEPENDENTVISITS POS ON PVS. VISITID = POS. DEPENDENTVISITID
WHERE PVS. AHCID = POS. AHCID
AND POS. AHCID = 37
AND POS. VISITID = 218
AND POS. ISDIABETIC = 0
AND SUPERIOR (PVS. VISITSTATUS) = 'PENDING'
Count (1)
-----------
1
PL/sql Developer explain plan for change request
Owner of description Objects_name cost cardin bytes cpucost cost of e/s
SELECT STATEMENT, TARGET = TIP: FIRST_ROWS 7 1 41 59257 7 AGGREGATION OF TRI 1 41 NESTED LOOPS NESTED LOOPS 7 1 41 59257 7 TABLE ACCESS BY INDEX ROWID AHC PATIENTDEPENDENTVISITS 4 1 16 36646 4 INDEX RANGE SCAN AHC K1_PATIENTDEPENDENT_AHCID 3 14 24364 3 INDEX RANGE SCAN AHC F1_PATIENTVISIT_AHCID 2 1 15293 2 TABLE ACCESS BY INDEX ROWID AHC PATIENTVISITS 3 1 25 22611 3 here after I changed the query no display cost = 7 io wait = improvement also 7 can someone please help these
How to adjust or rewrite lots of join not keys to multiple records on table table
Thank you
VSM
you have not answered my question. Are you really calling it 35 million times in 30 minutes?
If so, why?
-
Hello
I want to join the two tables to retrieve the data from the columns of the two table passing parameters to the join query. Tables have primary and foreign key relationships
Details of the table
Alert-1 - AlertCode (FK), AlerID (PK)
2 AlertCode-AlertDefinition-(PK)
Help, please
----------
Hi Vincent,.
I think that you have not worked on adf 12.1.3. In adf 12.1.3 you don't have to explicitly create the association. When you create the EO to your table, Association xxxxFkAssoc, will be created by ADF12.1.3 for you automatically. Please try this and do not answer anything... You can also follow the links below. I solved the problem by using the following link
---
-
How to connect to an Adobe Javascript(Folder Level Script) SAP Web Service and retrieve the response in a table of the Adobe Javascript/AcroJS. Could you please it explain with an example. I have two required input parameters that must be filled.
I s generic SOAP example/tutorial on my blog: get a serial number in a form using SOAP - KHKonsulting LLC
The web service uses only a single parameter, but you should be able to adapt the code to two arguments without problems.
-
JOIN the question... Join two tables without omitting lines
I came across a problem that should be an easy fix (I hope), but I'm having a hard time to come up with a solution.
Basically I have two tables, one with the actual amounts with the budget. I have to write a sql statement select that joins these tables together and includes all of their lines. I was able to join the tables by using JOIN, LEFT JOIN and RIGHT JOIN, but it always fails the lines I need.
Below, I have examples of my tables (AMOUNT_TABLE and BUDGET_TABLE). For simplicity, I built the examples to show the same values in the first four columns, with the 5th and 6th columns (SUB_ACCOUNT, AMOUNT, BUDGET) as the only values that are different. My actual tables are not quite that simple, but I don't think it was relavent to this issue.
AMOUNT_TABLE
FISCAL_YEAR PERIOD ACCT_UNIT ACCOUNT SUB_ACCOUNT AMOUNT 2013
1 11111 555555 0000 100 2013 1 11111 555555 1000 100 2013 1 11111 555555 2000 100 2013 1 11111 555555 3000 100 2013 1 11111 555555 4000 100 BUDGET_TABLE
FISCAL_YEAR PERIOD ACCT_UNIT ACCOUNT SUB_ACCOUNT BUDGET 2013
1 11111 555555 3000 200 2013 1 11111 555555 4000 200 2013 1 11111 555555 5000 200 2013 1 11111 555555 6000 200 Here's what I hope. Note that SUB_ACCOUNTs 0000, 1000, and 2000 show without budget amounts since there is not a corresponding line in the BUDGET_TABLE. And same for SUB_ACCOUNTs 5000 and 6000, they show budgets with no amount because there is not a corresponding line in the AMOUNT_TABLE.
(exit)
FISCAL_YEAR PERIOD ACCT_UNIT ACCOUNT SUB_ACCOUNT AMOUNT BUDGET 2013 1 11111 555555 0000 100 0 2013 1 11111 555555 1000 100 0 2013 1 11111 555555 2000 100 0 2013 1 11111 555555 3000 100 200 2013 1 11111 555555 4000 100 200 2013 1 11111 555555 5000 0 200 2013 1 11111 555555 6000 0 200 If all goes well, my question is clear. Any help on this would be greatly appreciated. Thanks in advance.
Use the join ANSI - FULL OUTER JOIN syntax:
with amount_table like)
Select fiscal_year 2013, 1 period, 11111 acct_unit, 555555, 0000 sub_account, amount 100 of all the double union
Select 2013,1,11111,555555,1000,100 from all the double union
Select 2013,1,11111,555555,2000,100 from all the double union
Select 2013,1,11111,555555,3000,100 from all the double union
Select double 2013,1,11111,555555,4000,100
),
budget_table like)
Select 1 time, 11111 acct_unit, account 555555, sub_account 3000, 2013 fiscal_year, budget of 200 Union double all the
Select 2013,1,11111,555555,4000,200 from all the double union
Select 2013,1,11111,555555,5000,200 from all the double union
Select double 2013,1,11111,555555,6000,200
)
Select nvl (a.fiscal_year, b.fiscal_year) fiscal_year,
period of NVL (a.period, b.period),
NVL (a.acct_unit, b.acct_unit) acct_unit.
account of NVL (a.Account, b.Account),
NVL (a.sub_account, b.sub_account) sub_account.
Amount NVL(a.amount,0),
NVL(b.budget,0) budget
of amount_table one
full join
budget_table b
on)
a.Fiscal_Year = b.fiscal_year
and
a.period = b.period
and
a.acct_unit = b.acct_unit
and
a.Account = b.account
and
a.sub_account = b.sub_account
)
/
FISCAL_YEAR PERIOD ACCT_UNIT ACCOUNT SUB_ACCOUNT AMOUNT BUDGET
----------- ---------- ---------- ---------- ----------- ---------- ----------
2013 1 11111 555555 0 100 0
2013 1 11111 555555 1000 100 0
2013 1 11111 555555 2000 100 0
2013 1 11111 555555 3000 100 200
2013 1 11111 555555 4000 100 200
2013 1 11111 555555 6000 0 200
2013 1 11111 555555 5000 0 2007 selected lines.
SQL >
SY.
-
Join the execution of several Tables Plan
Try to understand the query execution plan:
So he needs to MERGE between DEPARTMENTS (that has been sorted by index) JOIN and (here's the part confusing...) LOCATIONS including oracle used HASH JOIN (?) to bring the information from and then sort the opinion generated by the system that has been created...?HR> SELECT e.last_name , d.department_name, l.city 2 FROM employees e, departments d , locations l 3 WHERE e.department_id = d.department_id 4 AND 5 d.location_id = l.location_id; Execution Plan ---------------------------------------------------------- Plan hash value: 1235509609 -------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 106 | 4346 | 9 (23)| 00:00:01 | |* 1 | HASH JOIN | | 106 | 4346 | 9 (23)| 00:00:01 | | 2 | MERGE JOIN | | 27 | 837 | 6 (34)| 00:00:01 | | 3 | TABLE ACCESS BY INDEX ROWID| DEPARTMENTS | 27 | 513 | 2 (0)| 00:00:01 | | 4 | INDEX FULL SCAN | DEPT_LOCATION_IX | 27 | | 1 (0)| 00:00:01 | |* 5 | SORT JOIN | | 23 | 276 | 4 (50)| 00:00:01 | | 6 | VIEW | index$_join$_003 | 23 | 276 | 3 (34)| 00:00:01 | |* 7 | HASH JOIN | | | | | | | 8 | INDEX FAST FULL SCAN | LOC_CITY_IX | 23 | 276 | 1 (0)| 00:00:01 | | 9 | INDEX FAST FULL SCAN | LOC_ID_PK | 23 | 276 | 1 (0)| 00:00:01 | | 10 | TABLE ACCESS FULL | EMPLOYEES | 107 | 1070 | 3 (0)| 00:00:01 | --------------------------------------------------------------------------------------------------
Is that this HASH JOIN to step 7 only refers to a view that is generated by the system that oracle had to sort and not actually HASH JOIN
between two tables?
Thanks much for you patienceHello
Perhaps, it helps to understand things better if we walk in the plan.
Plans have a hierarchical structure (which is translated graphically by fingerprints). Operating needs parent all the children completed operations before it can do its job (which is generally combining lines with children in one way or another).
Another point is that joins can have anything like their entries, tables not only. That is a hash join can join an index for an index or a table to an index, or then to join a table results of hash one another and so on and so forth.
With this in mind, we can go back on what is happening here step by step:
The needs of the join by hash (1) (2) and (10) to finish. (10) is a basic operation, since a table scan depends on nothing else, but merge join handset (2) (3) and (5), who both are complex operations (i.e. dependent on one or more children). Specifically, lines (3) from the DEPARTMENTS table using ROWID obtained from a full analysis of the index of DEPT_LOCATION_IX (4), (5) is simply lines join hash (7) and sorted in the order required.
I hope this helps.
Best regards
NikolaiPublished by: Nikolay Savvinov on January 26, 2012 05:26
-
How to hide tables in the responses
Hello
Is it possible to hide the users tables in the responses. I would like to limit the view to allow users to view only certain facts and dimension tables.
Can anyone help?
Thank youHey, this might help you http://varanasisaichand.blogspot.com/2010/08/dataobjectcolumn-level-security-in.html
Come to answers you can't hide as such, but you can change the permissions accordingly.See you soon,.
KK -
How to join the table in screens LCD
Hello
How can I join the tables in the screens LCD and show them in a datagrid?
I run LCDS3 and tomcat.
Any help is appricitated
User (name, surname, address)
Address (address, State, country, postal code)
If you want to display data below in your data grid
---------------------------------------------------------------------------
firstName. lastName. State
---------------------------------------------------------------------------
user.firstName | user.lastName | User.Address.State
-
INVENTORY and ORDERS tables MANAGEMENT join the requirements
Hi all
I need to create a point of view, to display item_description item_number, quantity_in_warehouse and pendingquantity_in_salesorder.
query is based on the INVENTORY & ORDERS of tables. I wrote under query, it does not give the expected results. Please go through once and correct me if I did any wrong thing while writing the join conditions.
SELECT mtlb.segment1 Item_Number,
mtlb. Item_Description description,
mTLD.transaction_quantity Quantity_in_Wearhouse,
OEL.ordered_quantity PendingQuantity_in_SalesOrder
OF mtl_system_items_b mtlb.
mtl_onhand_quantities_detail mtld,
OEH oe_order_headers_all,
oe_order_lines_all oel
WHERE mtlb.inventory_item_id = mtld.inventory_item_id
AND mtlb.organization_id; = mtld.organization_id
AND mtlb.inventory_item_id; = oel.inventory_item_id
AND oeh.header_id; = oel.header_id
AND oeh.org_id; = oel.org_id
AND oeh.ship_from_org_id; = mtlb.organization_id
AND oel.ship_from_org_id; = mtlb.organization_id
AND mtld.subinventory_code AS "warehouse".
AND oel.flow_status_code AS 'AWAITING_SHIPPING '.
ORDER BY mtlb.segment1;
There is little urgency. Please help me solve this problem.
Thank you.
Published by: user627525 on July 19, 2010 04:35Just replace xxx in the query with your organization_id-
SELECT
MSI. As Item_Number Segment1
msi.description as Item_Description
SUM (ool.ordered_quantity) AS SO_quantity
AVG (oh_qty) as on_hand
Of
(SELECT
MSI.inventory_item_id, msi.organization_id, SUM (ohd.primary_transaction_quantity) AS oh_qty
Of
MSI mtl_system_items_b
JOIN ohd mtl_onhand_quantities_detail WE
(msi.inventory_item_id = ohd.inventory_item_id AND msi.organization_id = ohd.organization_id)
WHERE ohd.subinventory_code = 'Warehouse' AND msi.organization_id = xxx GROUP BY msi.inventory_item_id, msi.organization_id) Q1
JOIN THE
oe_order_lines_all ool ON (q1.inventory_item_id = ool.inventory_item_id AND q1.organization_id = ool.ship_from_org_id)
JOIN oe_order_headers_all ooh WE (ool.header_id = ooh.header_id)
JOIN msi mtl_system_items_b IT (ool.flow_status_code = 'AWAITING_SHIPPING' AND ool.inventory_item_id = msi.inventory_item_id AND ool.ship_from_org_id = msi.organization_id)
GROUP OF msi.inventory_item_id, msi.segment1, msi.description
ORDER BY msi.segment1 -
The ANSI syntax for the join 4 tables-is this correct?
Hi, I'm new to these forums and I have looked everywhere and cannot find the syntax and examples on how to join the tables 2 and 3 using the ANSI standard, but I need to reach 4. For a traditional join, it would be:
SELECT a.two b.one, b.three, b, a.one, d.seven
Tablea, tableb b, c in tablec, deposited d
WHERE a.one = b.one
AND a.two = c.two
AND c.six = d.six;
Here are the tables:
TableB
one
three
four
TableA
one
two
TableC
two
six
deposited
six
seven
eight
Anyone know how to do this by using an ANSI join or have all of the resources that can guide me in the right direction. I don't know if I wanted to join three tables, it would be:
SELECT a.two b.one, b.three, b, a.one, c.six
FROM tableb b JOIN tablea one WE b.one = a.one JOIN tablec c ON a.two = c.two;
so join a fourth would:
SELECT a.two b.one, b.three, b, a.one, d.seven
FROM tableb b JOIN tablea one WE b.one = a.one JOIN tablec c ON a.two = d JOIN filed c.two ON c.six = d.six;?
Is the above correct or is there another way to do this, use an ANSI join?
Published by: user1076466 on October 17, 2009 17:40Hello
your JOIN looks good,
"FROM tableb b JOIN tablea one WE b.one = a.one JOIN tablec c ON a.two = d JOIN filed c.two ON c.six = d.six" you get a different result set?
Thank you
-
[Help] Join the query from 3 tables
Hi, I'm new to database. I have a question about joining 3 tables, forgive me for my bad English.
My paintings look like this
Table 1: person (id, firstname, lastname)
Table 2: AssignPersonAddress (id, personid, addressid, type)
Table 3: address (id, phone, street, etc.)
I need AssignPersonAddress table, because in my data structure, a person may have more than 1 address and address type must be registered (for example: private, work)
I want to do a select query to the State any person with his private phone and work phone, like this.
NOBODY | PRIVATE | WORK
Right now my query looks like this
the problem is that I only get the person who has a private address and the job. But what I want is all anyone no matter if the person has only 1 or 2 address.select p.name , a1.tel AS Private, a2.tel AS Work from person p, addresse a1 , AssignPersonAddress apd1, AssignPersonAddress apd2, addresse a2 where p.id = apd1.person (+) and apd1.adresse = a1.id and apd1.art = 'Private' and p.objectid = apd2.person (+) and apd2.adresse = a2.id and apd2.art = 'Work'
As you can see I put the left outer join in where condition, but I always get the wrong result.
THX in advance
Danny
Published by: raitodn on October 1st, 2009 03:51
Published by: raitodn on October 1st, 2009 04:12
-
Join the table orders from clause
Hi all
Who is the effective way to join the tables in from clause. I have two tables first with 20 lakh records and second containing 10 lakh recods.
Who is the effective query 1 or 2. Please suggest me if you have an idea to rewrite the query.QUERY 1: SELECT T4.ID,T4.ISO_NAME FROM T,T4 WHERE T4.ISO_NAME LIKE '%US%' AND T.ID=T4.ID; QUERY 2: SELECT T4.ID,T4.ISO_NAME FROM T4,T WHERE T4.ID=T.ID AND T4.ISO_NAME LIKE '%US%'; T(ID IS PRIMARY KEY) (20 lakh records) T4 (ID IS PRIMARY KEY ) (10 lakh records) --------------------- ID ISO_NAME 100 US,UK,IN,BR 101 UK,US,BR,IN 102 BR,UK,US,IN Note: No index on ISO_NAME .
Kind regards
Rajasekhar
Published by: SuNRiZz68 on January 29, 2009 04:22In practical terms, Alex is right. Sometimes it matter what table is selected first, but does the CBO generally a very good job of deciding what you need to select the first (assuming that your statistics are up to date) but this is the situation you are trying to avoid as much as possible.
If you specify a table main command tables in the clause is not reliable and should be used - but think before using advice and don't do that when necessary.
Which table to select depends firstly on the join method in the execution plan. Nested loops joins perform better by selecting in the smaller table first, make a loop on the largest table. Joins the smaller set hash table in memory first, and then go through the larger table, perform searches in memory. He can't make any difference, what table is read using first the merger joins and sort.
Back to your original question. Using the cost-based optimizer, both queries will probably roll the same because newer versions of Oracle (9i, 10g) often transform queries for efficiency before the execution anyway. According to what do you or do not request should probably run a nested loop or hash join. With a small set of data creaing index and using a search of nested loops will probably be faster to avoid full table scans. the '%' in the LIKE clause leader would ignore an index on the ISO_NAME column in any case if a main column may be used in a composite index. All this is based on the approximation using the information provided; Tuning questions should always be tested to unexpected developments.
-
Hi guys,.
I am trying to use CD get time response data VI my VI. When I choose the pair of input-output, I can get the response data determined by the digital input to the output value. However, I need more of a pair of response data. I try to use the list of input-output, but there is no output data and response time of the VI with table 1 d of numbers.
My question is how to use the CD get time VI data response with the list of inputs-outputs configuration? Thank you.
Hey, Shapiro,.
I think the problem is you have two 0 items in the above table for you will be out this definition data twice. Let me know if this does not solve the problem for you.
Maybe you are looking for
-
How to mark a message as "answered"?
I'm having difficulties -
-
Hey guys -. Just got the phone, and it is regrettable, it restarts randomly. He has not slept for more than 20 minutes. Any ideas?
-
Wake model 11 AU58Y3K: speed of slot card SD 11 Stream?
The operating system is not serious. However, the computer dual-boots 10 Windows and Ubuntu-Mate 16.04. The question is, what is the speed of the interface to the SD card? I looked into the user's Guide and service manual (nor of which came with my c
-
WPD file system volume driver, card reader, code 10
Used to have a Vista system to windows 7 update on top and the card reader has worked without any problems, in fact a full install of windows 7, the card reader appears four times (once for each location in the card reader) 'device cant start code 10
-
How turn off highlight a word in a PDF document that has been saved?
How do the Nations United-point highlight a word in a PDF document that has been saved?