錯誤複現
先寫一個這樣的語句在測試環境下運行:
SELECT some_field1 FROM ( SELECT some_field1 from some_table where cond = 1 union all SELECT some_field1 from some_table where cond = 888 ) LIMIT 0, 50;
就會報上述故障Every derived table must have its own alias, 中文意思是少了個表別名, 加上就OK, 改成以下:
SELECT some_field1 FROM ( SELECT some_field1 from some_table where cond = 1 union all SELECT some_field1 from some_table where cond = 888 ) tbl LIMIT 0, 50;
完結撒花