在mysql服务器上触发两个查询会导致错误
我通过jdbc PreparedStatement触发两个select查询,在mysql服务器上触发两个查询会导致错误,mysql,sql,jdbc,Mysql,Sql,Jdbc,我通过jdbc PreparedStatement触发两个select查询, 这些查询由 分号(默认分隔符), 它给了我以下的错误 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:您的SQL语法有错误;查看与您的MySQL服务器版本相对应的手册,以了解在第1行“选择inq.preferred\u date为'dom',inq.id from assigned\u inquiries ai join inqu”附近使用的正确语法
这些查询由 分号(默认分隔符),
它给了我以下的错误 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:您的SQL语法有错误;查看与您的MySQL服务器版本相对应的手册,以了解在第1行“选择inq.preferred\u date为'dom',inq.id from assigned\u inquiries ai join inqu”附近使用的正确语法 选择inq.prefered_date as………是第二个查询的开始位置 编辑->查询
select
ms.next_date_of_meeting as 'dom',
ms.inquiry_id as 'id'
from
assigned_inquiries ai,
meeting_status ms
where
ai.representative_id = 1
and (
ai.status = 'postponed'
or ai.status = 'remeeting'
)
and ai.inquiry_id = ms.inquiry_id
and ms.next_date_of_meeting between '2012-1-1' and '2012-12-31'
and ms.created_on = (select max(created_on) from meeting_status where inquiry_id = ms.inquiry_id);
select
inq.preffered_date as 'dom',
inq.id
from
assigned_inquiries ai
join inquiry inq on ai.inquiry_id = inq.id
where
ai.representative_id = 1
and ai.status = 'new'
and inq.preffered_date between '2012-1-1' and '2012-12-31';
是否可以一次执行两个查询。
请提供帮助。您可以使用MySQL同时执行多条语句。但是,默认情况下禁用此功能。要启用它,请使用属性
allowMultiQueries
。有关更多信息,请参阅JDBC驱动程序的MySQL文档:您可以使用MySQL一次执行多条语句。但是,默认情况下禁用此功能。要启用它,请使用属性allowMultiQueries
。有关更多信息,请参阅JDBC驱动程序的MySQL文档:在我看来,这两个查询并不是问题所在。你能发布你的查询吗?我想这与“首选日期”拼写错误无关,是吗?我认为你不能在一个准备好的语句中发送两个select语句。@JeremyHolovacs:我也注意到了,但根据错误消息,看起来这不是问题所在,在我看来这两个查询不是问题所在。你能发布你的查询吗?我想这与“首选日期”拼写错误无关,是吗?我认为你不能在一个准备好的语句中发送两个select语句。@JeremyHolovacs:我也注意到了,但根据错误消息,看起来这不是问题所在。jdbc:mysql://localhost:3306/salesorder?allowMultiQueries=true 这是提及propertyjdbc的正确格式吗:mysql://localhost:3306/salesorder?allowMultiQueries=true 这是提到财产的正确格式吗