Go Back   Webmaster Malaysia Forum » Website Design & Development » Website Programming

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-10-2004, 11:40 AM
New kid on the block
 
Join Date: Oct 2004
Location: ktn
Posts: 8
Rep Power: 0
nixx is on a distinguished road
Nak dapatkan data terakhir bersama dgn GROUP BY

Dibawah ni ialah sql yg aku belajar daripada Gemp-X

SELECT kemajuan.*, tajuk.no_kontrak, tajuk.tajuk, tajuk.no_fail, stat.stat, bandar.bandar, kontraktor.nama, kontraktor.alamat, peruntukan.peruntukan, interim.interim, interim.tkh_int, interim.jml_int, (kemajuan.asal+kemajuan.vo) AS baru, sum(interim.jml_int) AS jumlah, (kemajuan.asal+kemajuan.vo-sum(interim.jml_int)) AS baki
FROM kemajuan INNER JOIN tajuk ON (kemajuan.tjk_id = tajuk.tjk_id) INNER JOIN stat ON (tajuk.sts_id = stat.sts_id) INNER JOIN bandar ON (kemajuan.bdr_id = bandar.bdr_id) INNER JOIN kontraktor ON (kemajuan.kontk_id = kontraktor.kontk_id) INNER JOIN peruntukan ON (kemajuan.prk_id = peruntukan.prk_id) INNER JOIN interim ON (kemajuan.kmj_id = interim.kmj_id)
GROUP BY kemajuan.tjk_id

Jadi macamana nak dapatkan data terakhir dari interim.jml_int kalau dalam ms access seperti url dibawah ni guna LAST(column) tapi dlm mysql macamana pulak

http://www.w3schools.com/sql/sql_functions.asp
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-10-2004, 12:51 PM
Gemp-X's Avatar
Novice Webmaster
 
Join Date: Apr 2002
Location: kuantan, pahang
Posts: 58
Rep Power: 80
Gemp-X is on a distinguished road
Send a message via Yahoo to Gemp-X
bile lak aku ajar ni.pening plak aku tengok heheh
kalo MySQL tak silap aku

ORDER BY interim.jml_int DESC LIMIT 1

( SUSUN MENGGUNAKAN Interim.jml_int KE BAWAH HADKAN KEPADA 1 ) camni kot translation dia

tapi camtu dia akan susun ikut nilai interim.jml tu. kalo nak last row, kene guna field id (autoicrement) (ORDER by id DESC limit 1)
__________________
http://sidik.org/

Last edited by Gemp-X; 07-10-2004 at 01:01 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-10-2004, 04:04 PM
New kid on the block
 
Join Date: Oct 2004
Location: ktn
Posts: 8
Rep Power: 0
nixx is on a distinguished road
Tak jadik lah apabila query bersama dengan GROUP BY tapi kalau tak ade GROUP BY ok ahhh ...

Data yg keluar adelah data yg terakhir data field tersebut bukan data terakhir untuk senarai item
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-10-2004, 05:49 PM
Novice Webmaster
 
Join Date: Sep 2004
Location: Shah Alam
Posts: 68
Rep Power: 51
infeeneetee is on a distinguished road
ada beza ke LEFT JOIN ngan INNER JOIN?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-10-2004, 03:22 PM
New kid on the block
 
Join Date: Oct 2004
Location: ktn
Posts: 8
Rep Power: 0
nixx is on a distinguished road
Tak berapa pasti pasal saya join tu menggunakan perisian EMS Mysql manager. Ia letak INNER JOIN jadi saya guna je lah INNER JOIN asal data keluar ok ah bagi saya.

Cuba tanya sape sape yg arif pasal JOIN ni ...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 08-10-2004, 03:30 PM
Novice Webmaster
 
Join Date: Nov 2003
Location: malaysia
Posts: 25
Rep Power: 0
alien3d is on a distinguished road
Send a message via MSN to alien3d Send a message via Yahoo to alien3d
pening gak main join ni akyah join pun takper
cam select * from table1,table2 table1.id=table2.id lagi senang kalau web join takyah pasal refer dengan id dari get variable
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 08-10-2004, 05:10 PM
Novice Webmaster
 
Join Date: Sep 2004
Location: Shah Alam
Posts: 68
Rep Power: 51
infeeneetee is on a distinguished road
sebab skang saya guna LEFT JOIN .. nak tau gak apa beza antara left ngan inner tuh.. mungkin abg GEMP-X bleh kasitau kot..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 10-10-2004, 04:37 AM
Novice Webmaster
 
Join Date: Sep 2004
Location: Shah Alam
Posts: 68
Rep Power: 51
infeeneetee is on a distinguished road
cuba tuka GROUP BY jadi ORDER BY
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 10-10-2004, 03:03 PM
Gemp-X's Avatar
Novice Webmaster
 
Join Date: Apr 2002
Location: kuantan, pahang
Posts: 58
Rep Power: 80
Gemp-X is on a distinguished road
Send a message via Yahoo to Gemp-X
tah le, aku tak biasae guna join2 nih, download mysql manual ade dia cite pasal LEFT JOIN, INNER JOIN etc nih

Quote:
The NATURAL [left] JOIN of two tables is defined to be semantically equivalent to an INNER JOIN or a LEFT JOIN with a USING clause that names all columns that exist in both tables.

INNER JOIN and , (comma) are semantically equivalent. Both do a full join between the tables used. Normally, you specify how the tables should be linked in the WHERE condition.
baik pakai koma je (SELECT * FROM table1,table 2 WHERE .....), simple sket
__________________
http://sidik.org/

Last edited by Gemp-X; 10-10-2004 at 03:10 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Local Adsense Group Seminar? Where are They? iamfreelancer Revenue and Monetization 0 22-01-2007 04:09 PM
Streamyx User Group starsearcher Mamak Stall 3 23-09-2006 11:04 PM
how to become an owner of yahoo e-group awida Mamak Stall 3 12-11-2005 09:08 AM
Let's Do "Sepetang Bersama ..." kidino Revenue and Monetization 23 08-11-2005 08:50 AM
KL PHP Meetup group zaimlah Website Programming 1 21-12-2004 08:51 AM



All times are GMT +8. The time now is 02:28 PM. Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.


WebmasterMalaysia.com is Proudly Hosted by Exabytes Semi Dedicated Server.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59