我收到一個MySQL錯誤這個代碼ExpressionEngine 1.6.4(很老的版本)ExpressionEngine查詢模塊和訂購SQL UNION
{exp:query limit="10" paginate="bottom"
sql="SELECT 'gallery' AS `content_type`, `cat_id` AS `entry_id`, `recent_entry_date` AS `entry_date`
FROM `exp_gallery_categories`
WHERE `gallery_id` = 9 AND total_files > 0
UNION
SELECT 'video' AS `content_type`, `entry_id`, `entry_date`
FROM `exp_weblog_titles`
WHERE `weblog_id` = 6 ORDER BY `entry_date` DESC"
}
<p>{content_type} - {entry_id} - {entry_date format="%d %F %Y"}</p>
{paginate}{pagination_links}{/paginate}
{/exp:query}
的MySQL返回此:
MySQL ERROR: Error Number: 1054
Description: Unknown column 'entry_date' in 'order clause'
Query: SELECT COUNT(*) AS count FROM `exp_gallery_categories` WHERE `gallery_id` = 9 AND total_files > 0 UNION SELECT COUNT(*) AS count FROM `exp_weblog_titles` WHERE `weblog_id` = 6 ORDER BY `entry_date` DESC
似乎像EE在MySQL之前修改我的查詢並使其失敗(在SQL客戶端上,這可以順利運行)。
FYI:現在有一個EE具體的S大頭釘交換站點:http://expressionengine.stackexchange.com。您可以在那裏發佈未來EE相關的問題。 –
如果我刪除'{paginate} {pagination_links} {/ paginate}'一切正常,但我得到所有結果並失去分頁。 – Angus