日期:2014-05-17  浏览次数:20595 次

求个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里是如何查询的,请帮帮忙!

------解决方案--------------------
SQL code
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)