user表:
uid    name    pass1     test    1232    hetest   982 3    teskoo    213
tel 表:(例如 user 表 uid = 1 没有填写tel 所以不在tel表里)uid   tel  2     125858583     8585685
要求生成合并表为uid  name     pass     tel1    test     1232    hetest   982    125858583    teskoo    213   8585685

解决方案 »

  1.   

    select a.*,b.tel
    from `user` a left join tel b on a.id=b.id
      

  2.   

    select a.*,b.tel
    from `user` a left join tel b on a.uid=b.uid
      

  3.   

    select user.uid,user.name,user.pass,tel.tel from user left join tel
    using(uid)
      

  4.   

    Select A.* ,B.Tel From USER A Join Tel B on A.uid=B.uid
      

  5.   

    select a.*,b.tel
    from `user` a left join tel b on a.uid=b.uid
      

  6.   

    我想 把 tel 数据  INSERT INTO 到 user 表里  ) 
      

  7.   

    select * from user a left join tel b using(udi);
      

  8.   

    我想 把 tel 数据  INSERT INTO 到 user 表里  ) insert into user(uid) select uid from tel;