select * from 表 where @a between 起始列 and 结束列
------解决方案--------------------
------解决方案-------------------- 我觉得他想要的是这样的结果:
SQL code
USE tempdb
GO
CREATE TABLE test
(
sscore FLOAT,
escore FLOAT,
class VARCHAR(6)
)
INSERT INTO test
SELECT 0,59, '不及格'
UNION ALL
SELECT 60,80, '良'
UNION ALL
SELECT 81,100, '优秀'
SELECT * FROM test
DECLARE @a FLOAT =23.5
SELECT @a,class
FROM test
WHERE @a BETWEEN sscore AND escore
------解决方案--------------------