求个PHP,MYSQL关联查询语句
Article表: ID, ClassID, Title
Class表: ClassID, ClassName
要求查询Article表时根据ClassID的值从Class表中取出ClassName
像MSSQL里的 select (select classname from table_b where classid=table_a.classid), * from table_a
不知道MYSQL里是如何查询的,请帮帮忙!
[解决办法]
selete Article.ClassID,Class.ClassID,Class.ClassName as AClassName from rticle,Class where Article.ClassID=Class.ClassID
[解决办法]
SQL code
select Article.ID Class.ClassName Article.Title from Article inner join Class on (Article.ClassID=Class.ClassID)