Mysql版本5.1。 代碼示例:mysql select union不起作用
mysql_query("SELECT * FROM abonents WHERE `session_id`='$current_sess_id' UNION SELECT * FROM abonents_problem WHERE `session_id`='$current_sess_id' UNION SELECT * FROM abonents_stop WHERE `session_id`='$current_sess_id'");
運行。如果刪除 「聯盟」,例如:
mysql_query("SELECT * FROM abonents WHERE `session_id`='$current_sess_id'");
「WTF代碼」 永遠=):
$rez_11_one = mysql_query(
"SELECT * FROM abonents WHERE `session_id`='$current_sess_id'"
);
$rez_11_two = mysql_query(
"SELECT * FROM abonents_problem WHERE `session_id`='$current_sess_id'"
);
$rez_11_three = mysql_query(
"SELECT * FROM abonents_stop WHERE `session_id`='$current_sess_id'"
);
if ($rez_11_one) {
$rez_11 = $rez_11_one;
} elseif ($rez_11_two) {
$rez_11 = $rez_11_two;
} else {
$rez_11 = $rez_11_three;
}
感謝對幫助