select money from user,money where user.id=1 and user.name=money.user

解决方案 »

  1.   

    1。国内有一本书,mysql的,去china-pub.com搜索以下,推荐的那本,不错,讲得很清楚,如果在西安可以找我哈
    2.支持,只不过方法不一样(个人意见)
    3。同一楼上,呵呵,好久没写
      

  2.   

    select b.money from `user` a left join `money` b on a.name = b.user
    where a.id = 1支持left join
    mysql4.1开始支持嵌套查询
      

  3.   

    left join我还是不懂什么意思,赫赫。
      

  4.   

    不懂left join,只能说明你没学过数据库原理,这是数据库的东西不是mysql特有的。
    left join是数据库多个关系外部连接中的一种,相对于right join,full join 和自然连接(又叫交叉连接,笛卡儿连接,好像是吧)。left join就是DBMS会选择一个关系,然后根据条件去连接第二个关系,right join是选择第二个关系,然后根据条件去连接第一个关系,全连接就是左连接加上右连接,自然连接就是两两交叉连接。假设
    table1(id, name) 元组(1, 'meteorlet') (2, 'imsorry')
    table2(id,name) 元组(1, 'PHP爱好者') (3, 'imsorry.com.cn')条件都是 table1.id = table2.idtable1 left join table2的结果:
    (1, 'meteorlet', 'PHP爱好者')
    (2, 'imsorry', NULL)table1 right join table2的结果:
    (1, 'PHP爱好者', 'meteorlet')
    (3, 'imsorry.com.cn', NULL)table1 full join table2的结果:
    (1, 'meteorlet','PHP爱好者')
    (2, 'imsorry', NULL)
    (3, NULL, 'imsorry.com.cn')
    table1 cross join table2的结果:
    (1, 'meteorlet', 'PHP爱好者')
      

  5.   

    顺便提一下:
    select money from user,money where user.id=1 and user.name=money.user
    这种连接是笛卡儿连接,交叉连接,cross join
      

  6.   

    Meteorlet(Meteorlet) 讲的很透彻!