首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

小弟我想从第二条sql语句的结果中查询信息怎么处理?

2012-02-06 
我想从第二条sql语句的结果中查询信息怎么办??select max(SupplyState) from ( )select Supplyid,SupplySt

我想从第二条sql语句的结果中查询信息怎么办??
select max(SupplyState) from ( )

select Supplyid,SupplyState,SupplyPrice,SupplierMark from PurchasePrice where Operators='YD' and Province='SD' and Code='' and Par='50'



我想从第二条sql语句的结果中查询信息怎么办??
把第二条sql放进第一条sql语句的()中不对吗?
  怎么实现呢??



[解决办法]
select max(SupplyState) from (
select Supplyid,SupplyState,SupplyPrice,SupplierMark from PurchasePrice where Operators='YD' and Province='SD' and Code='' and Par='50'
) t

加上别名试一下。
[解决办法]

SQL code
select max(SupplyState) from (select Supplyid,SupplyState,SupplyPrice,SupplierMark from PurchasePrice where Operators='YD' and Province='SD' and Code='' and Par='50' ) t
[解决办法]
其实你直接用max即可,

SQL code
select max(SupplyState) from PurchasePrice where Operators='YD' and Province='SD' and Code='' and Par='50'
[解决办法]
select max(SupplyState)from PurchasePrice where Operators='YD' and Province='SD' and Code='' and Par='50'

只要直接从purchaseprice表中取数即可。

热点排行