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.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Assignt to right value to the corresponding rows

Author  Topic 

Vadz
Starting Member

11 Posts

Posted - 2012-12-13 : 15:15:30
if my table is like this in my database

Student Staff children
34 104 playing
34 104 playing
34 104 rugby
34 104 soccer
34 104 playing

i want the value 34 to assign only to playing, if rugby or soccer it should be 0 or empty set and staff(1024) to assign only to rugby and soccer.i was wondering can i do this in my expression if i have =Fields!XXX.value. if not how can i write this in query.i query and display my tables as this.which is fine.and value of 34 and 104 a constant value.

my final table result i want to be like this

Student Staff children
34 0 playing
34 0 playing
0 104 rugby
0 104 soccer
34 104 playing

thanks in advance

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-12-14 : 03:18:39
Use IIF
=IIF(Fields!children.value = "playing",Fields!Student.value,0)
for student and
=IIF(Fields!children.value = "rugby" Or Fields!children.value = "soccer",Fields!Staff.value,0)
for Staff

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -