mysql如何两表查询?

解决方案 »

  1.   

    select * from ta inner join tb on ta.id = tb.id
      

  2.   

    select * from A,B where a.id=b.id先读三遍《数据库系统概论(第四版)》 王珊 萨师煊   高等教育出版社 (掌握基础知识和概念) 然后再粗略浏览一遍MYSQL的官方手册。(方便以后查找,避免类似于考试的时候,给你本政治书也不知道答案在第几章,第几页)MySQL官方文档 http://dev.mysql.com/doc/refman/5.1/zh/index.html
      

  3.   

    select * from ta a inner join tb b on a.id = b.id
    or
    select * from ta a left join tb b on a.id = b.id
      

  4.   

    楼主的问题描述太模糊了。
    select a from tb1
    union
    select a from tb2这样也是2表查询
    select a,b from tb1,tb2 where tb1.id=tb2.id;
    这样也是2表查询