Yup setuju dengan bung Wadi, sebaiknya diperhatikan lagi normalisasinya.

 

Oh iya kalau dibanding dengan 

 

SELECT * FROM

(SELECT ID_COMPANY, CARA_BAYAR, BAYAR FROM  HR.TABLE_A 

UNION SELECT ID_COMPANY, CARA_BAYAR, BAYAR FROM HR.TABLE_B

UNION SELECT ID_COMPANY, CARA_BAYAR, BAYAR FROM HR.TABLE_C) X

WHERE X.CARA_BAYAR='TUNAI'

 

Costnya besaran mana ya bro?

 

From: [email protected] [mailto:[email protected]] On
Behalf Of Wadi Achmed
Sent: Tuesday, June 22, 2010 5:51 PM
To: [email protected]
Cc: Aud Solehuddin
Subject: Re: [indo-oracle] ask query SQL

 

  

Pertama: Maaf, saya balik nanya.
Kenapa tablenya ada 3 kalau atribut dan fungsinya sama semua?

Solusinya:

Kalau tablenya satu (nama table asumsi table_bayar):
------------------------------
Select id_company, bayar
from table_bayar
where cara_bayar = 'tunai';

Kalau masih maksa pake 3 table
------------------------------
select id_company, bayar
from table_a
where cara_bayar = 'tunai'
union all
select id_company, bayar
from table_b
where cara_bayar = 'tunai'
union all
select id_company, bayar
from table_c
where cara_bayar = 'tunai';

Sekali lagi saya sarankan diubah tablenya cukup satu aja.
Coba pelajari lagi konsep normalisasi database.

Cheers,
Wadi Achmed

On 6/22/2010 5:08 PM, Aud Solehuddin wrote:
> Dear all, terimakasih sebelumnya, minta bantuan nyari query SQL untuk
select dari table berikut :
>
>
>
> misal saya punya tiga table,
>
>
>
> table A
>
> id_company
>
> cara_bayar (tunai, bni, bca)
>
> bayar
>
> field lain2
>
>
>
> table B
>
> id_company
>
> cara_bayar (tunai, bni, bca)
>
> bayar
>
> field lain2
>
>
>
> table C
>
> id_company
>
> cara_bayar (tunai, bni, bca)
>
> bayar
>
> field lain2
>
>
>
> contoh isian :
>
> table A
>
>
>
> PT Coba
>
> 200000
>
> tunai
>
>
>
> table B
>
> PT Tes
>
> 500000
>
> bni
>
>
>
> table C
>
> PT Sample
>
> 1000000
>
> tunai
>
>
>
> hasil yang diharapkan (tampil yang tunai) :
>
>
>
> id_company bayar
>
> PT Coba 200000
>
> PT Sample 1000000
>
>
>
> bagaimana cara saya menampilkan id_company dan bayar, yang memiliki cara
bayar ='tunai'
>
>
>
> makasih atas bantuannya semuanya.. :)
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------------------
>
> --
> -----------I.N.D.O - O.R.A.C.L.E---------------
> Keluar: [email protected]
<mailto:indo-oracle-unsubscribe%40yahoogroups.com> 
> Website: http://indooracle.wordpress.com
> http://www.facebook.com/group.php?gid=51973053515
> -----------------------------------------------
>
> Bergabung dengan Indonesia Thin Client User Groups,
> Terminal Server, Citrix, New Moon Caneveral, di:
> http://indo-thin.blogspot.comYahoo! Groups Links
>
>
>
>
> 

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





Please consider  the environment before print out this email
===================================================================
==This message was scanned by Toyota Tsusho Indonesia Email Server Anti Virus==
===================================================================


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

Kirim email ke