select a.id,b.online,a.nane 
from room a,online b
where a.id=b.id
and b.online>0

解决方案 »

  1.   

    select id,online,nane 
    from room a,online b
    where a.id=b.id
    and b.online>0可以不?
    第一句
    一定要写成select a.id,b.online,a.nane 吗?
      

  2.   

    select a.id,a.online,b.name
    from online a
    left outer join room b 
    on a.id = b.id
    where a.online>0
      

  3.   

    select room.id,online,name
    from room,online
    where b.online>0 
    and b.id in (select id from a);一楼的方法好象也是对的
      

  4.   

    select room.id,online,name from room join online on room.id=online.id where online>0
      

  5.   


    第一句
    一定要写成select a.id,b.online,a.nane 吗?id前面一定要有表名或表的别名,online,name前面可以不要,因为id在两个表里都有,需要确定到底用那个表的id