此查询有效:
select ist_id, ist_opis , CAST(ist_sifra as float ) as sifra
from IZOBRAZBENA_STOPNJA
where ist_aktivno<>0
order by sifra
但如果我只想看到sifra = 5时我得到“无效的列名'sifra'。”
select ist_id, ist_opis , CAST(ist_sifra as float ) as sifra
from IZOBRAZBENA_STOPNJA
where ist_aktivno<>0 and sifra = 5
order by sifra
我尝试在另一个select中使用sql语句进行包装,然后使用“where sifra = 5”它也失败了..
答案 0 :(得分:0)
其中isk aktiv&lt;&gt; 0和ist_sifra = 5
或
其中isk aktivno&lt;&gt; 0和CAST(ist_sifra as float)= 5
答案 1 :(得分:0)
因为没有名为sifra的列。您也可以使用where子句进行转换
select ist_id, ist_opis , CAST(ist_sifra as float ) as sifra
from IZOBRAZBENA_STOPNJA
where ist_aktivno<>0 and CAST(ist_sifra as float ) = 5
order by sifra
或参考未发布的专栏
select ist_id, ist_opis , CAST(ist_sifra as float ) as sifra
from IZOBRAZBENA_STOPNJA
where ist_aktivno<>0 and ist_sifra = 5
order by sifra