读书人

sql语句写法有关问题,还请赐教

发布时间: 2013-07-11 15:38:46 作者: rapoo

sql语句写法问题,还请赐教
select name,(select * from aaa where name = 当前name) from aaa

需要怎么写法?

也就是说,我想要嵌套的查询语句的where条件name 等于当前查询的name


[解决办法]
select name,(select xx from aaa where name = a.name) from aaa a
不能用*吧,只能写一列
[解决办法]
select name,(select 这里只能有一个字段出现 from aaa b where a.name = b.name) from aaa a

读书人网 >SQL Server

热点推荐