I have this query:
$db
->prepare("INSERT INTO
events (post_id, table_code, other_id, user_id, author_id, date_time )
select ?, 15, ?, ?, ?, UNIX_TIMESTAMP()
UNION ALL
select ?, 15, ?, ?, ?, UNIX_TIMESTAMP()
from (select 1) as a
where 1=?
")->execute(array($answer_id, $answer_id, $author_ques_id, $author_ques_id,
$answer_id, $answer_id, $author_ques_id, $author_ans_id,
($yourCondition?1:0) ));
Please focus on this line:
from (select 1) as a
My query works as well and all fine.
I just remember I read somewhere there is a default-table-name (something like double
) which I can use it instead of (select 1) as a
in this case. Anybody knows what's that?
Aucun commentaire:
Enregistrer un commentaire