I am firing two select queries via jdbc PreparedStatement ,
the queries are seperated by
semi-colon(the default seperator),
and it gives me the following error
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 ‘select inq.preffered_date as ‘dom’ , inq.id from assigned_inquiries ai join inqu’ at line 1
select inq.preffered_date as ……… is where the second query begins.
Edit-> the query
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';
Is it possible to execute two queries at a time.
Help Please.
You can execute several statements at once with MySQL. However, this feature is disabled by default. To enable it, use the property
allowMultiQueries. See the MySQL documentation for JDBC driver for more information: http://dev.mysql.com/doc/refman/5.5/en/connector-j-reference-configuration-properties.html