我有一种情况,我正在使用这样的 UNION:
$query = "SELECT bigimage, heading, fullarticle, dateadded FROM news ";
$query .= "WHERE (state = '" . $USER->state . "' OR state = 'ALL') AND status = 1 AND newstype != 1 AND frontpage = 1 AND bigimage > '' ";
$query .= "UNION ";
$query .= "SELECT image, eventname, details, dateadded FROM events ";
$query .= "WHERE (state = '" . $USER->state . "' OR state = 'ALL') AND status = 1 AND frontpage = 1 AND image > '' ";
$query .= "ORDER BY dateadded DESC LIMIT 10";
$restresult = mysql_query($query);
现在,我想知道每个结果来自哪个表,所以我想知道是否可以为返回的每个结果添加某种自定义结果,以某种形式指示它来自哪个表。
我可以在返回的结果中以某种方式添加一个额外的“动态”列吗?