如何获取无法正常工作的Select语句(oracle 11g)?
使用:
SELECT * FROM (Select statement that returns 4 rows) where Column1= 1
不起作用:
SELECT * FROM (Select statement that returns 4 rows) where Column1= MIN(Column1)
错误=此处不允许使用群组功能
不起作用:
SELECT * FROM (Select statement that returns 4 rows) where Column1= MIN(Column1)
Group by (names of columns in select statement)
相同的组功能ERROR如上
答案 0 :(得分:3)
在SQL Server或Oracle中,尝试使用窗口函数:
select s.*
from (select s.*, min(column1) over () as mincolumn1
from (Select statement that returns 4 rows
) s
) s
where Column1 = minColumn1;
答案 1 :(得分:1)
SELECT * FROM(选择返回4行的语句ORDER BY Column1 ASC)其中rownum< = 1