MySQL Union Query没有返回预期的结果,

时间:2014-12-16 10:11:27

标签: mysql union

MySQL查询只返回联合中的第二个SELECT结果,我不知道为什么......你能帮助吗?

$query  = "SELECT name ";
$query .= "FROM nutrients ";
$query .= "WHERE name LIKE '%{$sqlsafe_query}%' ";
$query .= "LIMIT 30 ";
$query .= "UNION ALL ";
$query  = "SELECT name ";
$query .= "FROM supplements ";
$query .= "WHERE name LIKE '%{$sqlsafe_query}%' ";
$query .= "LIMIT 30";

1 个答案:

答案 0 :(得分:1)

$query  = "SELECT name ";

你是否缺乏。在=?

之前