Syed Raza
Syed Raza

Reputation: 331

How To Use Loop IN Sp or UDF Sql Server

i am trying to pass id to Sp then it will first get id's against it and then get data against those id using SP or by using UDF as i trying it by

select RequestFrom from UserReqest where RequestTo=10 and IsApprove=0

select * from user where user_ID= (i have to use all five id's here ?)

Hopes for your suggestions

Thanks in Advance

Upvotes: 0

Views: 61

Answers (1)

SWeko
SWeko

Reputation: 30912

There is an IN operator in SQL that does what you want:

select * 
from user 
where user_ID in (select RequestFrom 
                    from UserReqest 
                    where RequestTo=10 
                      and IsApprove=0)

Upvotes: 3

Related Questions