[PHP-DB] Left Join

2011-08-07 Thread Chris Stinemetz
I am tyring to build a query that will take the most recent stores.store_date column then join it with store_list.store_name where store_list.store_name and stores.store_subject match then return the most recent stores.store_date. I am guessing this will require some sort of join. I have been

Re: [PHP-DB] Left Join

2011-08-07 Thread Peter Lind
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 On 7 August 2011 21:53, Chris Stinemetz chrisstinem...@gmail.com wrote: I am tyring to build a query that will take the most recent stores.store_date column

Re: [PHP-DB] Left Join

2011-08-07 Thread Chris Stinemetz
On Sun, Aug 7, 2011 at 3:00 PM, Peter Lind peter.e.l...@gmail.com 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

RE: [PHP-DB] Left Join

2011-08-07 Thread Toby Hart Dyke
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