cari nilai terendah

Database dan Structured Query Language

cari nilai terendah

Postby yogan » 04 Nov 2010, 15:12

misalnya ada data seperti di bawah ini:

nilai1 | nilai2 | nilai3
30 40 50
50 80 100
65 75 80
25 40 30

anggap data itu tersimpan dlm tabel yag namanya table coba??
gmn query untk nampilin nilai terendah(25) dlam kumpulan data it??
thx bwt yang replay...
yogan
Junior Member
 
Posts: 30
Joined: 31 May 2010, 07:37

RE: cari nilai terendah

Postby D.E » 04 Nov 2010, 16:04

logika pattern-nya kira-kira seperti ini:

min( min( min(sum(nilai1)) , min(sum(nilai2)) ), min(sum(nilai3)) )

silahkan sesuaikan dengan sql pattern-nya :D
:idea: Dude, if you don't understand the basics and just want to get someone else write the code for you, it means you really shouldn't study computer science. Find different field!
User avatar
D.E
Senior Member
 
Posts: 638
Joined: 04 May 2010, 18:12

RE: cari nilai terendah

Postby yogan » 04 Nov 2010, 16:21

kq ad fungsi sum nya??mohon diperjlas
yogan
Junior Member
 
Posts: 30
Joined: 31 May 2010, 07:37

RE: cari nilai terendah

Postby D.E » 04 Nov 2010, 17:00

Eh iya sorry, ngga' pake sum ding haha :D
:idea: Dude, if you don't understand the basics and just want to get someone else write the code for you, it means you really shouldn't study computer science. Find different field!
User avatar
D.E
Senior Member
 
Posts: 638
Joined: 04 May 2010, 18:12

RE: cari nilai terendah

Postby n3o_cybertech » 04 Nov 2010, 17:00

@yogan : ya tinggal disesuaikan tha,dicoba2 dulu lah..
Hit Image if this post useful! :wavespin:

Delphi Rock!
User avatar
n3o_cybertech
Senior Member
 
Posts: 273
Joined: 04 May 2010, 18:03

RE: cari nilai terendah

Postby kemzoft » 05 Nov 2010, 16:30

Code: Select all
  1. SELECT min(nilaiA) As NilaiMinA, min(nilaiB) As NilaiMinB, min(nilaiC) As NilaiMinC,

  2.         CASE

  3.                 WHEN (min(nilaiB) > min(nilaiA)) & (min(nilaiA) < min(nilaiC)) THEN min(nilaiA)

  4.                 WHEN (min(nilaiA) > min(nilaiB)) & (min(nilaiB) < min(nilaiC)) THEN min(nilaiB)

  5.                 WHEN (min(nilaiB) > min(nilaiC)) & (min(nilaiC) < min(nilaiB)) THEN min(nilaiC)

  6.                 ELSE 'tidak ada nilai'

  7.         END

  8.         AS 'NilaiMin'

  9. FROM NamaTable



Semoga membantu...:)
Image
User avatar
kemzoft
Junior Member
 
Posts: 19
Joined: 02 Nov 2010, 12:03


Who is online

Users browsing this forum: No registered users and 1 guest

cron