Hallo Anantha

Join 3 Tables On MySQL

Posted on: August 31, 2007

I got some tasks from my lecture to deploy user complaint form.

I don’t know how to deploy…just try and try. And finally i know how to start. I use PHP and MySQL to deploy it. Generally, I make the form with PHP and html source code. I use 3 tables on MySQL to get Data that i want to show at form. I confuse how to join 3 tables.With help from my friend and GrandPa google, finally I know it. This the topology of that’s 3 tables:

1st table:

| Field | Type
| id | int(10)
| tanggal | varchar(30)
| nama | varchar(100)
| alamat | varchar(200)
| kota | varchar(25)
| email | varchar(150)
| idcom | int(10)
| idwil | int(10)

2nd table:

| Field | Type |
| idcom | int(10) |
| descom | varchar(100) |

3 rd table:

| Field | Type |
| idwil | int(10) |
| deswil | varchar(100) |

from 1 st table , i want to get 2 field idwil and idcom. this two field the same as 2nd table and 3rd table. I want to get deswil from 3rd table and descom from 2nd table. This is the syntax to join both 3 tables:

SELECT tanggal, nama, alamat, email, descom,deswil FROM tugas LEFT JOIN komplain ON tugas.idcom = komplain.idcom LEFT JOIN wilayah ON tugas.idwil = wilayah.idwil ORDER BY id

these will show 3 data from both 3 tables.

Maybe these info help you that have a problem like me..

thank you



1 Response to "Join 3 Tables On MySQL"

Terima kasih tutorialnya ya, semoga tetap eksis.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


August 2007
    Sep »

My !Yahoo



Amateur Radio Club ITB

Balikpapan blogger

KampungBlog.com - Kumpulan Blog-Blog
Personal blogs


RSS ComputerWorld

  • An error has occurred; the feed is probably down. Try again later.

RSS NetworkWorld

  • An error has occurred; the feed is probably down. Try again later.

RSS InfoWorld

  • An error has occurred; the feed is probably down. Try again later.
%d bloggers like this: