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 |
|
php95saj
Starting Member
43 Posts |
Posted - 2002-05-07 : 12:09:57
|
| I am trying to pull records from three tables, but don;t want to have repetition in the recordset returned.I have a profile table with tblProfile profileID (PIK), profileNametblProfileUsers profileID, userIDtblProfileLanguages profileID, languageIDA rpofile can have more than one authorized users and simmilarly a profile can have more than one languages.I was wondering if there was a way to return all information in one stored procedure.TIASharjeel |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2002-05-07 : 12:59:30
|
provide sample data and the desired resultset(s) . . . your requirements . . . quote: I was wondering if there was a way to return all information in one stored procedure.
. . . are not clear enuff.<O> |
 |
|
|
php95saj
Starting Member
43 Posts |
Posted - 2002-05-07 : 13:09:06
|
| OKtblProfileprofileID -- profileName---------------------------- 1029 Test Profile1tblProfileUsersprofileID --- userID--------------------------1029 3841029 4511029 2981035 120tblProfileLanguagesprofileID --- languageID----------------------------1029 341035 101029 591029 1etc...Now I want to pull entries frotblProfile for profileID=1029, at the same time I want to pull results from tblProfileUsres and tblProfileLangauges as well for this profile to show which users are in the profiles and what languages are in the profile. |
 |
|
|
YellowBug
Aged Yak Warrior
616 Posts |
Posted - 2002-05-08 : 06:08:04
|
| Please post the recordset you expect as the result.Without the desired output, I can only guess that you want either one recordset or 3 separate recordsets.1. One Recordsetcreate procedure up_GetProfileDetails (@profileID int)ASselect 'P', profileName from #tblProfile where profileID = @profileIDunionselect 'U', UserName from #tblProfileUsers INNER JOIN #Users ON #Users.ID = #tblProfileUsers.userID where profileID = @profileIDunionselect 'L', LanguageName from #tblProfileLanguages INNER JOIN #Languages ON #Languages.ID = #tblProfileLanguages.LanguageID where profileID = @profileIDGO2. Three recordsets.create procedure up_GetProfileDetails (@profileID int)ASselect * from #tblProfile where profileID = @profileIDselect * from #tblProfileUsers where profileID = @profileIDselect * from #tblProfileLanguages where profileID = @profileIDGO |
 |
|
|
|
|
|