Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

equivalent of JOIN in Oracle

Status
Not open for further replies.

huBBLe

Programmer
May 15, 2001
50
0
0
SG
i have the following SQL statement that works perfectly in Access but when i tried to use it in Oracle, it gives me a "SQL command not properly ended" error. Found out that Oracle does not actually support JOIN statement.

i need help in modifying the statement below so that it will work in Oracle. Thank You.

*****************************************************
SELECT
Product.ProductID,
Product.Name,
Product.Description,
Equipment.EquipmentID,
Equipment.Equipments

FROM Product

INNER JOIN Equipment ON Product.EquipmentID=Equipment.EquipmentID

WHERE
Name LIKE 'someValue'
OR
Description LIKE 'someValue'
OR
Equipments LIKE 'someValue'
ORDER BY Name;
 
SELECT P.ProductID,
P.Name,
P.Description,
E.EquipmentID,
E.Equipments
FROM Product P,
Equipment E
WHERE P.EquipmentID = E.EquipmentID
AND (
P.Name LIKE 'someValue'
OR
P.Description LIKE 'someValue'
OR
P.Equipments LIKE 'someValue' )
ORDER BY P.Name;
 
Assuming you want a products ProductID, Name and Description from the product table along with the equipmentID and Equipments from the Equipment table when there is a row in both tables matching on equipmentID then:

SELECT
Product.ProductID,
Product.Name,
Product.Description,
Equipment.EquipmentID,
Equipment.Equipments

FROM Product , Equipment
WHERE Product.EquipmentID=Equipment.EquipmentID
AND
(Product.Name LIKE 'someValue'
OR
Product.Description LIKE 'someValue'
OR
Equipment.Equipments LIKE 'someValue')
ORDER BY Product.Name;

If you want the product rows when there are no matching equipment rows then change the WHERE statement to:

WHERE Product.EquipmentID=Equipment.EquipmentID(+)

Hope this helps

JJSmith
JJ_Smith_@hotmail.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top