日期:2014-05-16  浏览次数:20871 次

请问该怎么写查询语句
如果表   A   字段id                 字段class
        表   B   字段NumberID     字段class

A的class对应B的NumberID

已知A的ID   ,查询   B的class


------解决方案--------------------
将记录及正确结果贴出来
TRY
SELECT * FROM A INNER JOIN B ON A.CLASS=B.NUMBER WHERE A.ID=[你的条件]
------解决方案--------------------


select b.class
from a inner join b on a.class=b.NumberID
where a.id=100
------解决方案--------------------
不谈效率的话还可用in
select class
from b
where NumberID in (select class from a where id=100)