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

求一条select,该怎么处理

2012-02-09 
求一条selectidsort13211334656要求根据网址中的id值选出所有对应的sort。比如当id为1时,其对应的sort为3,

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

热点排行