You are here: Re: Simple SQL Distinct...!? « MsSQL Server « IT news, forums, messages
Re: Simple SQL Distinct...!?

Posted by @sh on 02/27/06 17:07

Its basically an application where they've previously had lots of
opportunities to enter delivery address and so there's duplicates as they
enter a new one each time.

I'm adding a page that looks up all 'unique' Delivery Addresses (although
each has a unique DID, DeliveryID), and I want to just show the latest
unique addresses that have the highest DID

So instead of getting this...

, ### Waterleaze, Maidenbrook, Taunton, Somerset, Somerset, TA7 8PS
Test, Ston Easton, Bath, Bath, BA3 4DF
, ### Waterleaze, Maidenbrook, Taunton, Somerset, Somerset, TA7 8PS
, ### Waterleaze, Maidenbrook, Taunton, Somerset, Somerset, TA7 8PS
Test, Ston Easton, Bath, Bath, BA3 4DF
, ### Waterleaze, Maidenbrook, Taunton, Somerset, Somerset, TA7 8PS


You would get this...

, 120 Waterleaze, Maidenbrook, Taunton, Somerset, Somerset, TA7 8PS
Test, Ston Easton, Bath, Bath, BA8 4DF


The DID becomes a hidden value applicable to the radio button for that
address.

Does that make sense? The trouble with the two other suggestions is that the
DID column value doesn't actually become a usable field in the recordset
that I create in ASP.

Cheers, Ash


<markc600@hotmail.com> wrote in message
news:1141051443.398579.176470@v46g2000cwv.googlegroups.com...
> For the non-unique addresses, you will have a choice
> of DeliveryIDs, which one do you want?
>
> If you want just one of them, you can do this
>
> SELECT MAX(DeliveryID), Address, Organisation, Organisation, Town,
> County, PostCode
> FROM SOL_Delivery
> WHERE CustomerID = 15
> GROUP BY Address, Organisation, Organisation, Town,
> County, PostCode
>

 

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

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