读书人

求一条select,该怎么处理

发布时间: 2012-02-09 18:22:27 作者: rapoo

求一条select
id sort
1 3
2 11
3 3
4 6
5 6

要求根据网址中的id值选出所有对应的sort。
比如当id为1时,其对应的sort为3,就选出所有sort=3的记录。
本来这个可以直接通过网址赋值来获得,如x.aspx?id=1&sort=3
现在不想在网址后带很长的尾巴。




[解决办法]
Select * from [表] where sort = (select sort from [表] where [表].id = 1)
[解决办法]
select * from A,B where A.id = id and A.sort = B.sort

select * from A where A.id = id inner join B on A.sort = B.sort

读书人网 >asp.net

热点推荐