You are here: Re: Help with query... « PHP SQL « IT news, forums, messages
Re: Help with query...

Posted by ashok on 10/10/06 20:41

"MattMika" <mattmika@hotmail.com> ???????/???????? ? ???????? ?????????:
news:9rmni2dkhju1eg8bcn1pqt9ktefcptp5i7@4ax.com...
> I'm hoping someone can point me in the right direction on how to get
> what I want with this query.
>
> SELECT c.customers_firstname, c.customers_lastname,
> c.customers_email_address, ab.entry_street_address,
> ab.entry_street_address_2, ab.entry_city, ab.entry_postcode,
> z.zone_name as state
> FROM customers c
> LEFT JOIN address_book ab ON c.customers_id = ab.customers_id
> LEFT JOIN customers_info ci ON c.customers_id = ci.customers_info_id
> LEFT JOIN zones z ON ab.entry_zone_id=z.zone_id
> WHERE c.customers_newsletter="1"
> AND ci.customers_info_stores_id="10";
>
> This query works except the fact that the address_book table might
> have more that one entry for each customer. All I want is the first
> entry since this will be the billing address added when the customer
> signed up with us. How do I tell the query to only retrieve the first
> address_book entry?
>
> TIA
> "If you love wealth more than liberty, the
> tranquillity of servitude better than the
> animating contest of freedom, depart from us in
> peace. We ask not your counsel or your arms.
> Crouch down and lick the hand that feeds you.
> May your chains rest lightly upon you and may
> posterity forget that you were our countrymen."
> - Samuel Adams

something like
ORDER column ASC LIMIT 1;

 

Navigation:

[Reply to this 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

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