> this is the meat of the SP > > @value_needed is the value I need to get. it needs to be > a.adviceID from the first select. > > SELECT > a.userIDFK, a.adviceID, > UD.userPhotoPath AS adviceseekerPhotoPath, > UD.userPhoto AS adviceSeekerPhoto, > UD.userSensitivity AS adviceSeekerSensitivity, > UD.userCareer AS adviceSeekerCareer, > UD.userHumor AS adviceSeekerHumor, > UD.userPersonality AS adviceSeekerPersonality, > UD.userIntelligence AS adviceSeekerIntelligence, > UD.userDescription AS adviceseekerdescription > FROM Advice a INNER JOIN userData UD on A.userIDFK = UD.UserID > WHERE a.userIDFK = @Input_userID > > -- select data on "the other people" > SELECT > aa.Advice_aboutID, aa.AdviceIDFK, aa.PhotoDescription, > aa.adviceSensitivity, aa.adviceCareer, aa.adviceHumor, > aa.advicePersonality, > aa.adviceIntelligence, aa.PhotoPath, aa.Photo > FROM Advice_about aa > WHERE aa.adviceIDFK = @value_needed > > -- select existing ratings > SELECT > ar.adviceIDFK, ar.ratingUserID, ar.adviceFeedback, ar.rating, > UD.userLogin > FROM Advice_ratings ar LEFT OUTER JOIN userData UD on > ar.ratingUserID = > UD.UserID > WHERE ar.adviceIDFK = @value_needed > GROUP BY ar.ratingUserID, UD.userLogin, ar.adviceIDFK, > ar.adviceFeedback, ar.rating
Will the first query return a single value in all cases? If not, the whole thing doesn't make much sense. In any case, why not write the thing as one big SELECT statement? Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:226635 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

