Reply to a common SQL problem perhaps - using group by

Your name:

Reply:


Posted by cluthz on 06/14/07 14:56

I have a customer table and a customer_email_address table which are linked
as a customer can have multiple email addresses.

When I do a query that links the table, obviously it is possible that I
might get results with identical rows accept for the email_address field.

E.g.
select * from customer
Left join customer_email_address on (customer.id =
customer_email_address.cust_id)

As I want a list to show only one row for each customer of course I can use
groupby. Therefore adding
group by customer.id

But how do I know which row will be used when a customer has more then one
email address? Or to ask it another way, which email address will be
displayed.

Hopefully I have asked this question making it clear and simple as possible.
Thanks in advance.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация