sanket munj
sanket munj

Reputation: 29

How to use loop in where condtion in T-SQL query?

select * from student where roll-no in (30 to 50)

student is table name, roll_no, first_name, last_name, add are columns

How to print student details whose roll no between 30 to 50?

Upvotes: 1

Views: 31

Answers (2)

juergen d
juergen d

Reputation: 204746

 select * from student 
 where roll-no between 30 and 50

Upvotes: 0

Hannah Vernon
Hannah Vernon

Reputation: 3472

You need to use a where clause with a range like:

 select * from student where [roll-no] >= 30 and [roll-no] <= 50;

Upvotes: 1

Related Questions