日期:2014-05-18  浏览次数:20493 次

求一条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