要看你用什么数据库,不同的数据库的SQL语法不尽相同
如果是oracle
select * from tab where substr(to_char(colname,'yyyymmdd'),5,2)=:month;
如果是anywhere
select * from tab where month(colname)=:month;
data ld_stardate,ld_enddate
ld_stardate=data(string(year(today()))+'/'+string(month(today()))+'/1')
choose month(today())
case 1,3,5,7,8,10,12
ld_enddate=data(string(year(today()))+'/'+string(month(today()))+'/31')
case 4,6,9,11
ld_enddate=data(string(year(today()))+'/'+string(month(today()))+'/30')
case 2
if mid(year(today()))=0 then
ld_enddate=data(string(year(today()))+'/'+string(month(today()))+'/29')
else
ld_enddate=data(string(year(today()))+'/'+string(month(today()))+'/28')
end if
end choose
select * from table where col_date between :ld_stardate and ld_enddate using sqlca;
data ld_stardate,ld_enddate
ld_stardate=data(string(year(today()))+string(month(today()))+'/1')
choose month(today())
case 1,3,5,7,8,10,12
ld_enddate=data(string(year(today()))+string(month(today()))+'/31')
case 4,6,9,11
ld_enddate=data(string(year(today()))+string(month(today()))+'/30')
case 2
if mid(year(today()))=0 then
ld_enddate=data(string(year(today()))+string(month(today()))+'/29')
else
ld_enddate=data(string(year(today()))+string(month(today()))+'/28')
end if
end choose
select * from table where col_date between :ld_stardate and ld_enddate using sqlca;