【SQL查询语句】根据路程公里数来判断价格-该怎么解决

【SQL查询语句】根据路程公里数来判断价格-急
tbl表,里面有3个字段
公司编号 公里数 价格
  1 5 10.00
  1 10 19.00
  1 15 25.00
  2 10 100.00
  2 20 150.00
  2 30 200.00

公里数和价格是不规律,根据不同公司的需要改变。公里数区间内包含情况是 公里数<=x<公里数

现在假设是公司1#,我给数据库传入一个 公里数x= 16,在1#公司,16公里是25.00。
  在2#公司,16公里就是150.00

如果判断?能够判断出价格,在线等解。急

这是我自己写的,只能判断一边。
SELECT
case when gls >= @gls then jg end as jg
from tbl
where gsid='1'

------解决方案--------------------
SQL code
select top 1 jg from tb1
where gsid=1 and gls<=@gls
order by gls desc

------解决方案--------------------
select top 1 jg from tb1 where gsid=1 and gls<=@gls order by gls desc
--把在输入公里数范围内的按降序排列,取第一行,也就是最接近输入的那个公里数,这个对应的价格就是需要查询的价格