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 |
helixpoint
Constraint Violating Yak Guru
291 Posts |
Posted - 2008-11-24 : 14:41:18
|
I have 2 tables Cars and CarPicsCars-CarIdCarTypeIdCarnameCarPics-CarPicId CarIdImageImageDefault - This is a bitI want to do a select That brings back a certain CarTypeId. I want to join it to the CarPics table and bring back just the one pic that is makers in the ImageDefault field. There is only one image marked as default for each CarPicIdCars1 2 Mustang2 2 CorvetteCarPics1 1 Pic1 12 1 Pic2 03 2 pica 04 2 picb 1So for a car 2 CarTypeID. This is what I want to bring back1 Mustang Pic14 Corvette picbDaveHelixpoint Web Developmenthttp://www.helixpoint.com |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-11-24 : 17:41:01
|
select cp.carpicid,cr.carname,cp.imagefrom Cars cr inner join Carpics cpon cr.carid = cp.caridand cp.ImageDefault = 1 |
|
|
|
|
|