Re: Select from multiple tables

From: Date: Wed, 29 Feb 2012 14:05:03 +0000
Subject: Re: Select from multiple tables
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-48206@lists.php.net to get a copy of this message
On Wed, Feb 29, 2012 at 3:01 PM, Kranthi Krishna <kranthi117@gmail.com> 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

« previous php.db (#48206) next »