Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Mondeo
Constraint Violating Yak Guru
287 Posts |
Posted - 2007-07-17 : 12:41:09
|
| I have thisSELECT t1.capid, t2.cvehicle_mantext, t2.cvehicle_modtext, t2.cvehicle_dertextFROM dbStock..tblVehicles t1 JOIN PUB_CAR..CapVehicles t2ON t1.capid = t2.cvehicle_idWHERE t1.noimage = 1ORDER BY t2.cvehicle_mantext, t2.cvehicle_modtext, t2.cvehicle_dertextI've just used JOIN but its returning odd results, I want to return all the vehicles in the tblVehicles Table and any matches from CapVehiclesWhich join to use?Thanks |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-07-17 : 12:43:34
|
| inner join seems about right. you just have to join on the proper columns._______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
rudesyle
Posting Yak Master
110 Posts |
Posted - 2007-07-17 : 12:51:50
|
quote: Originally posted by Mondeo I have thisSELECT t1.capid, t2.cvehicle_mantext, t2.cvehicle_modtext, t2.cvehicle_dertextFROM dbStock..tblVehicles t1 JOIN PUB_CAR..CapVehicles t2ON t1.capid = t2.cvehicle_idWHERE t1.noimage = 1ORDER BY t2.cvehicle_mantext, t2.cvehicle_modtext, t2.cvehicle_dertextI've just used JOIN but its returning odd results, I want to return all the vehicles in the tblVehicles Table and any matches from CapVehiclesWhich join to use?Thanks
If you need to return ALL vehicles, even if the have no matches in the CapVehicles table, then you will need to use an OUTER JOIN |
 |
|
|
|
|
|
|
|