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 |
|
pwcphoto
Yak Posting Veteran
69 Posts |
Posted - 2005-07-03 : 19:07:37
|
| Related to the previous posting. When I run this it only returns only one record which is the first record of the friends table. It doesnt step through the rest of the To_ID in the friends table.SELECT * (((UF2_Comments INNER JOIN UF2_rt_Friends AS Friends ON (Friends.To_id=UF2_Comments.User_id))INNER JOIN UF2_rt_users AS Photographer ON (Photographer.user_id=UF2_Comments.Photog_id))INNER JOIN UF2_rt_users AS Critiquer on (Critiquer.user_id=UF2_Comments.User_id))WHERE (dbo.UF2_Comments.Image_Active = 1) AND (dbo.UF2_Comments.Comment_Active = 1) AND (Friends.From_ID = 82) AND (UF2_Comments.Photog_ID = 82)These are other derivations that I had tried.SELECT * FROM UF2_rt_Friends AS f, UF2_Comments AS c, UF2_rt_images AS iWHERE f.From_ID = '82' AND f.To_ID = c.User_id AND c.Image_ID = i.image_id AND i.user_id = f.From_IdSELECT * FROM UF2_rt_Friends AS f, UF2_Comments AS c, UF2_rt_images AS iWHERE f.To_ID = c.User_id AND c.Image_ID = i.image_id AND i.user_id = '82'SELECT *FROM (SELECT * FROM UF2_rt_Friends AS f, UF2_Comments AS c WHERE f.To_ID = c.User_ID AND f.From_ID = '82') AS d, UF2_rt_images AS iWHERE i.Image_ID = d.Image_ID AND i.user_id = '82'All pretty much with the same results. Do I need to use an IN with the friends table to move it to the next row? At a bit of a loss here.Phil-----------------------I used to be a rocket scientist. Now I'm just a space cadet... |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2005-07-03 : 21:28:47
|
| Look up LEFT JOIN and RIGHT JOIN in Books Online.MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
|
|
|