Senin, 06 Februari 2012
Subquery lagi
update k set incentive=(case when percentage_am=1 then k.incentive else k.incentive/2 end)
from trmasterincentive_summary k
inner join (
select x.idstructure, incentive,
case when (cast(y.jumlahAM_ach as float)) / (cast (y.JumlahAM as float)) > 0.6
then 1
else 0
end percentage_am
from trmasterincentive_summary x
inner join (
select a.idstructure,
(select COUNT(distinct idstructure_am) from structorg where year=2011 and month=11 and idcat=10 and idstructure_sm=a.idstructure)JumlahAM,
(
select COUNT(distinct idstructure_am)
from trmasterincentive_summary p
inner join structorg q on (p.idstructure=q.idstructure_am and q.idstructure_sm=a.idstructure)
where idjob in(3,29) and percentage>=90
)jumlahAM_ach
from trmasterincentive_summary a
where idlogstructure=176 and idjob in(1,24) and percentage>=90
) y on (x.idstructure=y.idstructure)
) l on (k.idstructure=l.idstructure)
from trmasterincentive_summary k
inner join (
select x.idstructure, incentive,
case when (cast(y.jumlahAM_ach as float)) / (cast (y.JumlahAM as float)) > 0.6
then 1
else 0
end percentage_am
from trmasterincentive_summary x
inner join (
select a.idstructure,
(select COUNT(distinct idstructure_am) from structorg where year=2011 and month=11 and idcat=10 and idstructure_sm=a.idstructure)JumlahAM,
(
select COUNT(distinct idstructure_am)
from trmasterincentive_summary p
inner join structorg q on (p.idstructure=q.idstructure_am and q.idstructure_sm=a.idstructure)
where idjob in(3,29) and percentage>=90
)jumlahAM_ach
from trmasterincentive_summary a
where idlogstructure=176 and idjob in(1,24) and percentage>=90
) y on (x.idstructure=y.idstructure)
) l on (k.idstructure=l.idstructure)
Langganan:
Posting Komentar (Atom)
Blog Archive
About Me
- Koral Web
- Kami adalah web developer. Beberapa produk yang pernah kami buat antara lain website, aplikasi klinik, aplikasi apotik, aplikasi EDMS (Electronic Database Management System), Energy Consumption Management System, RKBI (Rencana Kunjungan Barang Import) dan lain-lain sesuai dengan request dari client kami. Jika Anda tertarik untuk membuat system atau aplikasi, jangan sungkan-sungkan menghubungi kami.
Bahasa Pemrogramanmu?
Nasihat
Barangsiapa capek lelah dan letihnya bukan karena Allah maka celakalah dia
Diberdayakan oleh Blogger.
Web Sunnah
Blog Archieve
- Info (3)
- Kajian (3)
- My Program (1)
- Orang Terkenal (1)
- scrip (2)
- SQL (23)
- Subquery (9)
- Trik (13)
0 comments:
Posting Komentar