首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

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

2013-03-25 
我又来纠结一条基础的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

热点排行