4
我是MySQL的新手,仍然有其語法問題。我有這個疑問:MySQL - 如何添加別名語法到子查詢
SELECT a, b, c, d, e
FROM table1
WHERE status = 'skipped'
AND batchid IN (SELECT batchid
FROM (SELECT distinct batchid, date_format(uploaddate, '%Y-%m-%d')
FROM table1
WHERE uploaddate > '2011-01-26') AS t
) AS t;
這給了我這個錯誤:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as t' at line 1
IN子句的工作原理:
SELECT batchid
FROM (SELECT distinct batchid, date_format(uploaddate, '%Y-%m-%d')
FROM table1
WHERE uploaddate > '2011-01-26') AS t
我想我的問題有事情做與第二表的別名。有人能告訴我我做錯了什麼嗎?
就是這樣。謝謝! – sdoca 2011-01-28 20:31:44