|
-
This is very useful advice for me from Hrishy
And check my previous query
SQL> SELECT MAX(YEAR_MON),MIN(YEAR_MON) FROM STOKCUMM;
MAX(YEAR_MON) MIN(YEAR_MON)
------------- -------------
200403 200001
real: 87265
The above is not using the index.
do this separately ,, it uses the index.
SQL> SELECT MIN(YEAR_MON) FROM STOKCUMM;
MIN(YEAR_MON)
-------------
200001
real: 47
SQL> SELECT MAX(YEAR_MON ) FROM STOKCUMM;
MAX(YEAR_MON)
-------------
200403
real: 31
or if we want them combined use hrishy's advice
select X.x,Y.y
from (
select min(YEAR_MON) x from STOKCUMM
)X,
(select max(YEAR_MON) Y from STOKCUMM
* )Y
> /
X Y
------ ---------
200001 200403
real: 16
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|