RE: Left Join

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
too!)

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.

  Toby


-----Original Message-----
From: Chris Stinemetz [mailto:chrisstinemetz@xxxxxxxxx] 
Sent: Sunday, August 07, 2011 9:33 PM
To: Peter Lind
Cc: php-db@xxxxxxxxxxxxx
Subject: Re:  Left Join

>On Sun, Aug 7, 2011 at 3:00 PM, Peter Lind <peter.e.lind@xxxxxxxxx> 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,

  Chris

>
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux