私は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
私の問題は、2番目のテーブルエイリアスと関係があると思います。誰かが私が間違っていることを教えてもらえますか?