Re: Getting single results per (left) record with INNER JOIN

2009-03-16 Thread Joerg Bruehe
Hi Nigel, all ! Nigel Peck wrote: > [[...]] > > My query is: > > SELECT > `People`.`person_id`, > `People`.`name` > FROM > `People` > INNER JOIN > `Person_postal_addresses` > ON > `Person_postal_addresses`.`person_id` = `People`.`person_id` > WHERE > `People`.`name` REGE

Re: Getting single results per (left) record with INNER JOIN

2009-03-14 Thread Nigel Peck
Johan De Meersman wrote: Either HAVING, or an additional GROUP BY field of person_postal_address.person_id should do, I think. That's great, thanks, just what I needed :) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mys

Re: Getting single results per (left) record with INNER JOIN

2009-03-14 Thread Johan De Meersman
Either HAVING, or an additional GROUP BY field of person_postal_address.person_id should do, I think. On Sat, Mar 14, 2009 at 8:38 PM, Nigel Peck wrote: > Arthur Fuller wrote: >> >> Won't a simple LIMIT 1 do what you want? Or am I missing something? > > Thanks for getting back to me. You're missi

Re: Getting single results per (left) record with INNER JOIN

2009-03-14 Thread Nigel Peck
Arthur Fuller wrote: Won't a simple LIMIT 1 do what you want? Or am I missing something? Thanks for getting back to me. You're missing something, but I probably didn't explain very well. There can be multiple matches from the People table, but when more than one address matches, I get more

Re: Getting single results per (left) record with INNER JOIN

2009-03-14 Thread Arthur Fuller
Won't a simple LIMIT 1 do what you want? Or am I missing something? Arthur On Fri, Mar 13, 2009 at 3:24 PM, Nigel Peck wrote: > Nigel Peck wrote: > >> SELECT >>`People`.`person_id`, >>`People`.`name` >> FROM >>`People` >> INNER JOIN >>`Person_postal_addresses` >> ON >>`Person

Re: Getting single results per (left) record with INNER JOIN

2009-03-13 Thread Nigel Peck
Nigel Peck wrote: ... My query is: SELECT `People`.`person_id`, `People`.`name`, FROM `People` INNER JOIN `Person_postal_addresses` ON `Person_postal_addresses`.`person_id` = `People`.`person_id` WHERE `People`.`name` REGEXP 'example' OR `Person_postal_addresses`.

Getting single results per (left) record with INNER JOIN

2009-03-13 Thread Nigel Peck
I'm hoping someone can point me in the right direction for what I need, to save me trawling through books and Google when I don't know what I'm looking for. I'm using an INNER JOIN to query a table that has a one-to-many relationship with the table in my FROM clause, but I only want one res