|
| |||||||||
| Tags: joining, oracle, sql, sql query, tables, three |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| SQL Query For Joining Three Tables
hi I am having problem regarding sql query. My query consists of three tables in MS Access that I want to join the together. My query is: SELECT * from (Customer_Details left join EMAS on Customer_Details.street_name = EMAS.street_name ) left join work_orders on Customer_Details.ID = work_orders.customer_ID where Proceed_Retrofit = 'yes' Now this query gives me various identical records which actually does not exist. I want to view the three relevent records (where Proceed_Retrofit = 'yes') from Customer_details and the associated data from the other tables. please help me regarding his sql query. your views will be appreciated |
|
#2
| ||||
| ||||
| Re: SQL Query For Joining Three Tables
I guess this query should work as a solution for you: SELECT Distinct * from Customer_Details Left Outer join EMAS on Customer_Details.street_name = EMAS.street_name Left Outer join work_orders on Customer_Details.ID = work_orders.customer_ID where Proceed_Retrofit = 'yes' |
|
#3
| ||||
| ||||
| Re: SQL Query For Joining Three Tables
i gues this is where the "duplicates" arise... do you have a proper key to this table..? if you have the error is solved. try using a proper key for your query
__________________ Grand Theft Auto 4 PC Video Game |
|
#4
| ||||
| ||||
| Re: SQL Query For Joining Three Tables
this will definitely work for you SELECT p.Name, v.Name FROM Production.Product p JOIN Purchasing.ProductVendor pv ON p.ProductID = pv.ProductID JOIN Purchasing.Vendor v ON pv.VendorID = v.VendorID WHERE ProductSubcategoryID = 15 ORDER BY v.Name and the result is: LL Mountain Seat/Saddle Chicago City Saddles ML Mountain Seat/Saddle Chicago City Saddles HL Mountain Seat/Saddle Chicago City Saddles LL Road Seat/Saddle Chicago City Saddles ML Road Seat/Saddle Chicago City Saddles HL Road Seat/Saddle Chicago City Saddles LL Touring Seat/Saddle Chicago City Saddles
__________________ The FIFA Manager 2009 PC Game |
|
#5
| ||||
| ||||
| Re: SQL Query For Joining Three Tables
try this one: SELECT Abbrevdesc FROM T_abbrevs WHERE Abbrevcode IN (Select Abbrevcode FROM T_Companies_Abbrevs WHERE CompanyID IN (SELECT CompanyID FROM T_Corp_Companies)) |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "SQL Query For Joining Three Tables" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Join two tables using SQL query | vaib288932 | Software Development | 3 | 20-08-2010 01:01 PM |
| Want to make query dependent on another query. | MACE | Software Development | 4 | 01-02-2010 05:22 PM |
| MySQL query in a query | Rail racer | Software Development | 3 | 21-07-2009 08:06 PM |
| Turn on MySQL query cache to speed up query performance | DMA2Superman | Software Development | 3 | 07-07-2009 11:26 AM |
| SQL query between 2 tables linked by many to many relationship | Luis234 | Software Development | 2 | 09-05-2009 03:17 PM |