Table referencing

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
tumbleweed
Forum Newbie
Posts: 3
Joined: Wed Nov 19, 2003 10:02 am

Table referencing

Post by tumbleweed »

Hi can anyone help?

I am trying to write a program that uses information from one mysql table and references another, based on the users input. E.G The information is equipment so the user selects what equipment they require like video cameras. I want the program to reference the number of video cameras with the date required and the date returned (this is so I dont get any double bookings) it also needs to reference the days in between as there is a maxium of 5 days on each booking. I have created a function that counts the days from the date required so thats not a problem.

I have only two tables equipment and booking

the booking table

bookid
date
time
equip1
equip2
equip3
equip4
equip5
date required
date returned

the equipment table

equipid
equipname
equipnumber (Each peace of equipment has been given a number like DVC001)[/php_man]
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

This information is provided to you in your MySQL Documentation.

Here is how to get to it ( i'll then give you a link you can use that will tell you where it is located ).

1) Go to the directory where you have MySQL ( usually C:\mysql\)
2) Go into the Docs directory.
3) Double Click on "manual.html"
4) when it opens up, click on the address at the top, and at the end of the address, type #Multiple_tables

so, your ending result should look something like this : C:/mysql/Docs/manual.html#Multiple_tables

here, you will find all the information necessary to do what you want. All you have to do is follow the same rules you would for querying data for one table, only you will be doing it for more than one. Hope that helps.
tumbleweed
Forum Newbie
Posts: 3
Joined: Wed Nov 19, 2003 10:02 am

Table referencing

Post by tumbleweed »

Thank you infolock i was already doing what you suggested but when i looked at the manual i then looked at my program in a different way and now have sorted my problem.
Post Reply