coba aza pakai sub query

Ola Geulis


  ----- Original Message ----- 
  From: Rianto Utomo 
  To: [email protected] 
  Sent: Monday, October 05, 2009 1:04 PM
  Subject: Re: [indo-oracle] habis union lalu di group


    klo ngga salah sih tinggal tambahin super querynya lagi pak, select * from
  (union diatas) group by cd_barang

  cmiiw
  -rie

  2009/10/5 <[email protected]>

  >
  >
  > Hello ,
  >
  > mau tanya sehabis union all, hasil datanya baru di group lagi
  > berdasarkan cd_barang caranya bagaimana ya ?
  > tks
  >
  > select
  > a.cd_barang,
  > a.s_pcs,
  > a.s_harga
  > from
  > stock a
  > union all
  > select
  > b.cd_barang,
  > sum(b.pcs) as t_pcs,
  > sum(b.harga) as t_harga
  > from
  > terima b
  > group by
  > b.cd_barang
  > union all
  > select
  > c.cd_barang,
  > sum(c.pcs)*(-1) as t_pcs,
  > sum(c.harga)*(-1) as t_harga
  > from jual c
  > group by
  > c.cd_barang
  >
  >
  > --
  > Best regards,
  > fansul
  > mailto:[email protected] <fansul%40yahoo.co.id>
  >
  > __________________________________________________
  > Apakah Anda Yahoo!?
  > Lelah menerima spam? Surat Yahoo! memiliki perlindungan terbaik terhadap
  > spam
  > http://id.mail.yahoo.com
  >
  > 
  >

  [Non-text portions of this message have been removed]



  

[Non-text portions of this message have been removed]

Kirim email ke