小弟我又来纠结一条基础的SQL语句了

我又来纠结一条基础的SQL语句了本帖最后由 wangxuebo 于 2013-03-23 11:01:06 编辑type表typeidtypenamepa

我又来纠结一条基础的SQL语句了
本帖最后由 wangxuebo 于 2013-03-23 11:01:06 编辑 type表

typeid   typename  parentid
   1       水果         0
   2       葡萄         1
   3       香蕉         1

content表
  id     btype    stype
   1       1        3

查询出结果

1   水果   香蕉
[解决办法]

select a.typename,b.typename from content 
join [type] a
on a.typeid=content.btype
join [type] b
on b.typeid =content.stype