Selecting 3 database tables at the same time ?? if that makes sense.

Selecting 3 database tables at the same time ?? if that makes sense.

am 09.07.2006 09:40:13 von Mr Smith

I have not tried it yet, but.

I need to open a table, look at every row of data. Then select a
particular field every time, get its contents. Then do a search for
that value in another table (in the same database), than return
another value from the searched rows fields.

From that returned value do the same again in another table (in the
same database), and return another value.

Then do a bit of calculations etc

Then go back and look at the next row in the original table, and
repeat again until the end.

Re: Selecting 3 database tables at the same time ?? if that makessense.

am 09.07.2006 11:09:35 von Shion

Mr Smith wrote:
> I have not tried it yet, but.
>
> I need to open a table, look at every row of data. Then select a
> particular field every time, get its contents. Then do a search for
> that value in another table (in the same database), than return
> another value from the searched rows fields.
>
> From that returned value do the same again in another table (in the
> same database), and return another value.
>
> Then do a bit of calculations etc
>
> Then go back and look at the next row in the original table, and
> repeat again until the end.

Use JOIN in your query, see the mysql page who to use join (works the same way
in most sql) http://dev.mysql.com/doc/refman/5.0/en/join.html

Use a while-loop for fetching the data and calculate it, there is a somewhat
useful example in the php manual
http://www.php.net/manual/en/function.mysql-fetch-array.php


//Aho