本文介绍了MySQL 错误:每个派生表都必须有自己的别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到此错误

每个派生表都必须有自己的别名"

当我运行这个查询时

SELECT firstname, lastname, artistId
FROM  artist
WHERE artistId=(
    SELECT artistId
    FROM roles
    WHERE movieCode ='$movie[movieCode]' and  role = 'Director'
) a

推荐答案

$row1=mysqli_query($conn,"
SELECT firstname, lastname, artistId
FROM  artist WHERE
artistId=(SELECT artistId FROM roles WHERE movieCode ='$movie[movieCode]' and  role = 'Director') AS table_alias ")or die(mysqli_error($conn));

这应该可行,每个子查询都必须有一个别名AS".

This should work, every subquery must have an alias "AS".

这篇关于MySQL 错误:每个派生表都必须有自己的别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-30 09:32