declare @include1 table
(
attrid char(10),
attrtype char(6)
)
insert into @include1(attrid,attrtype)
select attrid,attrtype
from attribute
where attrype in ('s1','s2')
declare @include2 table
(
schoolID char(10),
school char(6)
)
insert into@include2(schoolID,school)
select schoolID,school
from schoolTable
where school = '2'
select coreid
from coreTable
inner join @include1
on coreid = attrid
union
select coreid
from coreTable
inner join @include2
on coreid=schoolID
Now I want to identify who was selected in which group. For example if a person was selected in @include1 then I want a column that says 'include1', same for @include2. Is this done through a row() function or something else
(
attrid char(10),
attrtype char(6)
)
insert into @include1(attrid,attrtype)
select attrid,attrtype
from attribute
where attrype in ('s1','s2')
declare @include2 table
(
schoolID char(10),
school char(6)
)
insert into@include2(schoolID,school)
select schoolID,school
from schoolTable
where school = '2'
select coreid
from coreTable
inner join @include1
on coreid = attrid
union
select coreid
from coreTable
inner join @include2
on coreid=schoolID
Now I want to identify who was selected in which group. For example if a person was selected in @include1 then I want a column that says 'include1', same for @include2. Is this done through a row() function or something else