sql查询分析器查询问题

来源:百度知道 编辑:UC知道 时间:2024/06/18 14:04:50
我要从storage_inout_bills_history中找到fiscal_month一项为2008年全年的数据, 但是fiscal_month中的格式是2008_01类型,就是说是分月份的,01就是一月02就是2月这种,我该怎么写语句?
select *
from storage_inout_bills_history
where fiscal_month =‘’
双引号内应该写什么,求教高人回答
刚才我说错了,标点不对,所以没查出来,不好意思,不过查了没出任何项。。。

对不起 我的错 ,谢谢大家 解决了 1楼是最先的正解,所以分给1楼了~谢谢帮忙解决

select *
from storage_inout_bills_history
where left(fiscal_month,4) =‘2008’

select *
from storage_inout_bills_history
where left(fiscal_month,4) =‘2008’

select *
from storage_inout_bills_history
where fiscal_month LIKE ‘2008%’

如果列fiscal_month有索引用 left 将用不到索引
怎麼会错?你用的不是Sql server?

select *
from storage_inout_bills_history
where fiscal_month LIKE ‘2008%’

fiscal_month like '2008%'

1楼的结果是对的,你的怎么就会语法错误了呢?