我想从第二条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表中取数即可。