LearnItFirst User Forum

SQL Server 2008 SSAS Training Videos
Welcome Guest Search | New Posts | Members | Log In | Register

Getting value for (User Input/dynamic) column from table Options
Laxmikant
Posted: Saturday, March 06, 2010 11:57:08 PM
Rank: Newbie

Joined: 3/6/2010
Posts: 1
Points: 3
Where do you live?: India
I have two tables named IN_Heads, Emp.

IN_Heads has one column named Head_Desc with following values

Head_Desc

..................

Basic

DA

HRA

Emp table has following structure:

Emp_No :: BASIC :: DA :: HRA :: LTA :: Canteen

20 :: 4330 :: 340 :: 2763 :: 300 :: 0

21 :: 4000 :: 600 :: 2133 :: 500 :: 30

27 :: 7320 :: 100 :: 3163 :: 600 :: 60

23 :: 5690 :: 900 :: 4663 :: 100 :: 70

25 :: 8355 :: 150 :: 1563 :: 200 :: 0

Now my problem is I want to get from EMP table Addition of only those columns' values which are present under Head_Desc of table IN_Heads. (i.e. (Basic + DA + HRA) only, excluding LTA & CANTEEN as they dont appear in IN_Heads table). Values of Head_Desc may vary time to time.

I'm using stored procedures and user defined functions. I need to write a function for the above to get a single float value for given employee, say emp_no 21.

Any suggestion. Its urgent. Please.
Scott Whigham
Posted: Friday, March 12, 2010 5:16:03 AM


Rank: Super Mod

Joined: 3/20/2006
Posts: 476
Points: 1,053
Where do you live?: Dallas, TX
I'm sorry but I only half way understand your question.
Quote:
Now my problem is I want to get from EMP table Addition of only those columns' values which are present under Head_Desc of table IN_Heads. (i.e. (Basic + DA + HRA) only, excluding LTA & CANTEEN as they dont appear in IN_Heads table). Values of Head_Desc may vary time to time.
I don't get that at all - I'm lost on what you are asking.
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.