Re: Select from multiple tables

Matijn Woudt <[email protected]>
Newsgroups gmane.comp.php.database
Message-ID <CAC_gtuMORhFAJ72441wDvxXmz5m+ZuQEyCERuqh7j4Cj3nzxoQ@mail.gmail.com>
On Wed, Feb 29, 2012 at 3:01 PM, Kranthi Krishna <[email protected]> wrote:
> Hi all,
>
> Say I have an object like
>
> array
>    schoolName => string
>    board => array
>         string
>         string
>
> I generally create  two MySql tables
>
> schools: id PRIMARY KEY, SchoolName
> boards: id FOREGIN KEY refers Table A(id), board
>
> and then do two selects. The problem is that, the number of selects
> increase as the number of one-to-many relationships increase.
>
> Is there a better way to do this ? I have to extend an existing code
> so I cannot use any libraries like doctrine
>
> Kranthi.
> http://goo.gl/e6t3

You should look up at SQL joins. They will do what you want.

- Matijn

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.