문제

I have a table with a sales column and date of that sales column, and I want to select the min and max and the date of this min and max for response a single max with its date and single min with its date, in Oracle, but I don't know how do it, any idea?

Thanks

도움이 되었습니까?

해결책

From your Explanation it looks like you need something like below:

1) SELECT Sales , date FROM TABLE_NAME WHERE Sales = ( SELECT MIN(Sales) FROM TABLE_NAME)

2) SELECT Sales , date FROM TABLE_NAME WHERE Sales = ( SELECT MAX(Sales) FROM TABLE_NAME)

In single Query

    SELECT Sales , date FROM TABLE_NAME WHERE Sales = ( SELECT MIN(Sales) FROM TABLE_NAME)

    UNION 

    SELECT Sales , date FROM TABLE_NAME WHERE Sales = ( SELECT MAX(Sales) FROM

 TABLE_NAME)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top