MySQL Linked tables Query help

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
davro
Forum Newbie
Posts: 8
Joined: Fri Nov 01, 2002 6:54 am

MySQL Linked tables Query help

Post by davro »

Currently working with
PHP 4.2.3
MySQL 3.23.54
phpMyAdmin 2.3.3pl1

Im using two mysql tables example below.
Im trying to find out howto link fields within them.
How would i go about linking table request, field Department to table departments, field Department
If this is possable with linked tables would it also be possable to have mysql store this query
So requests.Department outputs the linked table data, when used by php.
Rather than php passing querys all time?

(requests)
ID
Request
Request_Date
Requset_Status
Department +

(departments)
ID
Department +

Please help me PHPDN kenobi you are my only hope.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

mysql does not support stored procedures by now.
http://www.mysql.com/doc/en/ANSI_diff_Triggers.html wrote:The planned update language will be able to handle stored procedures. Our aim is to have stored procedures implemented in MySQL Server around version 5.0. We are also looking at triggers.
By linking tables do you mean join? http://www.mysql.com/doc/en/JOIN.html
Rob the R
Forum Contributor
Posts: 128
Joined: Wed Nov 06, 2002 2:25 pm
Location: Houston

Post by Rob the R »

I think a view would do this for you. This way, you could set up a view that is really a query that joins the two tables, but you would use the view as if it were a table. Unfortunately, MySQL does not support views yet.
davro
Forum Newbie
Posts: 8
Joined: Fri Nov 01, 2002 6:54 am

Post by davro »

Cheers volka, rob

As im currently not to well informed with mysql
But with mysql well documented site and your replys im getting there.

Reason i am approching mysql like this is because of the way i have setup
php to read the mysql tables, dynamically building html forms depending
on the mysql field column type with out running any real query as such.
So if anything in the database is changed, the php output changes to suit.

Join looks like it would work if mysql had the option of stored procedures.
View would also proberly work if mysql supported this option.
Nether the less, mysql, phpmyadmin, are impressive pieces of kit.

Cheers all for your help
Post Reply