Is the design under your control? If so, you need to change it. Your
store_list.store_name field breaks the first rule of relational databases -
it isn't atomic. That means that you have two pieces of information there -
the store name and store address. You even have a '~' there to separate them
(nice try, but no).

It's not clear what the function of the 'stores' table is, but there's a
nasty smell coming from there as well (and a field with tilde-separated data

If this *is* your design, then you might want to show what the source data
looks like. If it's not your design, you have my permission to tell the
owner off ;-)

Not that this really has anything to do with PHP, but I won't say anything
if you won't.


-----Original Message-----
From: Chris Stinemetz [] 
Sent: Sunday, August 07, 2011 9:33 PM
To: Peter Lind
Subject: Re: [PHP-DB] Left Join

>On Sun, Aug 7, 2011 at 3:00 PM, Peter Lind <> wrote:

> >Maybe it's just me, but I can't see anything that would work as

>foreign key for you to join on - neither table seems to have a foreign
> >key

 Sorry for my ignorance. How do I create the foreign key? The two columns
from each table that have a similar relationship are stores.store_mar and
store_list.id_market. Once the foreign key is build what would be the
correct syntax to achieve my query?

Thank you very much,



PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to