mysql 1067 42000_MySQL在程序中运行包异常,ERROR 1067 (42000)

在程序中运行sql报错,

ERROR 1067 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TEMPORARY TABLE tmp_table

SELECT acc.accId, acc.accName, '2010-06-10' as tmpDate FROM '

sql语句如下:

DROP TABLE IF EXISTS tmp_table;

CREATE TEMPORARY TABLE tmp_table

SELECT acc.accId, acc.accName, '2010-06-10' as tmpDate FROM tbl_account acc;

insert into tmp_table SELECT acc.accId, acc.accName, '2010-06-11' as tmpDate FROM tbl_account acc;

insert into tmp_table SELECT acc.accId, acc.accName, '2010-06-12' as tmpDate FROM tbl_account acc;

select tmp.accName,att.seqId,att.attendanceType,att.beginDateTime,att.comment

from tmp_table tmp left join tbl_attendance att

on tmp.accId = att.accId

and tmp.tmpDate = str_to_date(att.beginDateTime, '%Y-%m-%d')

and str_to_date(att.beginDateTime, '%Y-%m-%d') >= '2010-06-10'

and str_to_date(att.beginDateTime, '%Y-%m-%d') <= '2010-06-12'

where 1=1;

DROP TABLE tmp_table;

这段sql在MySQL中运行没问题,但是放到程序中运行就报异常,目前程序是基于struts2 + spring + hibernate,请大家指点一下,谢谢

2010年6月22日 15:39

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值