Home  >  Article  >  Backend Development  >  求问超级简单的数据表查询如何写

求问超级简单的数据表查询如何写

WBOY
WBOYOriginal
2016-06-13 12:08:30958browse

求问超级简单的数据表查询怎么写?
表A字段:id  title  text

表B 字段:id Aid  

表A的id 存为表B的Aid。

查询出表B的 Aid,然后再通过Aid查询出表A的title  ,直接写出一句SQL,怎么写?
------解决思路----------------------

selcet * from A where id IN (select Aid from b);

不知道是不是你想要的。
------解决思路----------------------
select B.Aid,A.title from B join A on B.Aid=A.id
------解决思路----------------------
select A.title from A,B where A.id=B.Aid 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn