select ccd.PERIOD_ID,ccd.CMPNT_COST
from cm_cmpt_dtl ccd,mtl_system_items_b msi
where msi.INVENTORY_ITEM_ID = ccd.INVENTORY_ITEM_ID
and ccd.ORGANIZATION_ID = msi.ORGANIZATION_ID
and msi.ORGANIZATION_ID = :A01
and ccd.PERIOD_ID = :PERIOD_ID2
select MAX(PERIOD_ID)TOP1 from GMF_PERIOD_STATUSES
select MAX(PERIOD_ID) TOP2 from GMF_PERIOD_STATUSES order by PERIOD_ID
SELECT MAX( col )
FROM table
WHERE col < ( SELECT MAX( col )
FROM table )
select top 1 col
from (
select top 2 col
from [table]
order by col) topTwo
order by col desc
select MAX(PERIOD_ID) TOP1 from (select MAX(PERIOD_ID) TOP2 from GMF_PERIOD_STATUSES order by PERIOD_ID ) TOP2 order by PERIOD_ID desc
select *
from(
select MAX(PERIOD_ID) TOP1 From GMF_PERIOD_STATUSES ,
select MAX(PERIOD_ID) From GMF_PERIOD_STATUSES
where PERIOD_ID <(select MAX(PERIOD_ID) TOP2from GMF_PERIOD_STATUSES) ,
(select MAX(PERIOD_ID) TOP3 From GMF_PERIOD_STATUSES
where PERIOD_ID <(select MAX(PERIOD_ID) from GMF_PERIOD_STATUSES where PERIOD_ID <(select MAX(PERIOD_ID) from GMF_PERIOD_STATUSES)))))
(select * from
(
select MAX(PERIOD_ID) TOP3 From GMF_PERIOD_STATUSES
where PERIOD_ID <(select MAX(PERIOD_ID) TOP2 from GMF_PERIOD_STATUSES where PERIOD_ID <(select MAX(PERIOD_ID) TOP1 from GMF_PERIOD_STATUSES))
select TOP2,ccd.CMPNT_COST from
(select MAX(PERIOD_ID) TOP2 from GMF_PERIOD_STATUSES
where PERIOD_ID <(select MAX(PERIOD_ID) TOP1 from GMF_PERIOD_STATUSES))BB,cm_cmpt_dtl ccd
where ccd.PERIOD_ID = TOP2
select ccd.CMPNT_COST from
(
select MAX(GPS.PERIOD_ID) TOP2, ccd.CMPNT_COST from GMF_PERIOD_STATUSES GPS,cm_cmpt_dtl ccd
where GPS.PERIOD_ID <(select MAX(PERIOD_ID) TOP1 from GMF_PERIOD_STATUSES)
and ccd.PERIOD_ID = GPS.PERIOD_ID
group by GPS.PERIOD_ID,ccd.CMPNT_COST
where ccd.PERIOD_ID = TOP2
)) TOP
No comments:
Post a Comment
Text Message