我得到一個錯誤,指出: 「未知列‘story2.time’‘以條款’」mysql命令根據條款
我的SQL語句是:
mysql_query("SELECT headline, story2.time FROM story2 WHERE username='Michael' UNION
SELECT headline, story2.time FROM story2 JOIN subscriptions WHERE subscriptions.subpaperid = story2.artnewsid AND subscriptions.papernameurl = story2.papernameurl AND subscriptions.username = 'Michael' UNION
SELECT headline, story2.time FROM story2 JOIN bookmark WHERE bookmark.writername = story2.username AND bookmark.articleid = story2.random AND bookmark.username = 'Michael'
ORDER BY story2.time DESC LIMIT 0,25") or die(mysql_error());
上做任何幫助下面的查詢工作將不勝感激。謝謝!
您不能使用'union'按順序引用'story2' - 它不再存在。只要刪除它 - '按時間順序desc ...' – sgeddes