SELECT `a`.`id` AS `ID`, `a`.`name` AS `标题`, `b`.`name` AS `所属` FROM `table` AS `a` LEFT JOIN `table` AS `b` ON (`b`.`id` = `a`.`fid`) WHERE `a`.`id` = 7
######select id,name as biaoti, sort as sushi from where######我有个想法和楼上不一样(我认为这个说正确答案了),回头我测试一下我自己的看法再回复。创建虚拟表######手机发错了,######
SELECT `a`.`id` AS `ID`, `a`.`name` AS `标题`, `b`.`name` AS `所属` FROM `table` AS `a` LEFT JOIN `table` AS `b` ON (`b`.`id` = `a`.`fid`) WHERE `a`.`id` = 7
非常感谢,解决问题了!
把table as成两个区分就行了!
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。