- 论坛徽章:
- 0
|
perl跟mysql交互,通过dbi连接后,将mysql数据查询出来,好像不支持case when
请问大家有解决办法吗?
my $sth=$dbh->prepare(select b.name as "名称",
case when a.OBJTYPE ="1" then (select t1.nickname from area t1 where t1.ref_id=a.ref_id)
when a.OBJTYPE ="4" then (select t2.nickname from city t2 where t2.city_id=a.city_id)
when a.objtype ="3" then "3333"
when a.OBJTYPE ="2" then "4444"
end "对象",
a.sett_date as "周期"
from sett_results a,group_detail b
where a.objid=b.id and a.method=1
order by a.objid,a.sett_date");
$sth->execute;
上面执行过程中报错。Bareword found where operator expected at 13.pl line 16, near ""1" then"
(Missing operator before then?)
请问有什么解决办法吗? |
|