|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
SQL Query aproch
Hello all,
I have following tables as ListOption ID Int PK Name Varchar UserEducation Id int PK EducationLevel Int FK EducationArea Int Fk Center Varchar Here EducationLevel and EducationArea are foreign keys from ListOption table. now while selecting data from UserEducation table i want that FK Id's should be replaced with the Name from ListOption table. i had created one function for returning the value of the Name from ListOption table. CREATE FUNCTION [dbo].[GetListOptionDetails] ( @fListOptionID int ) RETURNS nvarchar(255) AS BEGIN RETURN (SELECT Name from ListOption where Id = @fListOptionID) END SELECT id, starSuiteUserId , EducationLevel, dbo.[GetListOption](EducationLevel) as EducationAreaDetails , EducationArea, dbo.[GetListOption](EducationArea) as EducationAreaDetails ,Center FROM UserEducation WHERE id = @id; i had return this query but i dont feel this is an right way as i had this case in most of the tables in my DB. Thanks Kunal |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > SQL Query aproch |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|