日期:2014-05-17  浏览次数:20434 次

SQL 语句
表一t1的结构
RebateItem
21
21
21
表二t2的结构
OldId  Name
21     2010年度奖励
(t1的RebateItem与t2的OldId  对应)
我现在想得到的结果
RebateItem  Name
21          2010年度奖励
21          2010年度奖励
21          2010年度奖励
我用select  select  * from t2 where t2 .OldId in(select RebateItem from  t1 )
得到确实一条数据
求SQL大神帮小弟得到我想要的结果
SQL

------解决方案--------------------
SELECT a.RebateItem, b.Name
FROM t1 a
INNER JOIN t2 b
ON a.RebatItem = b.Oldid