[thelist] Jet SQL help
Maximillian Schwanekamp
lists at neptunewebworks.com
Sun Jan 23 15:35:18 CST 2005
Ken Schaefer wrote:
> Something like:
> SELECT
> MIN(a.UserName)
> , a.UserEmail
> FROM
> Users AS a
> GROUP BY
> a.UserEmail
>
> will select the first user name (sorted alphabetically) for each unique email
> address.
>
> The query is a bit of a "hack" though. You tend to see that when your data
> isn't normalised. When data is normalised, the queries tend to write
> themselves.
Ah! Thanks so much Ken! Yes, normalizing was the whole idea - deriving
the "one" for what would correctly be a one->many relation
(customers->orders). I had not thought of using MIN() on a non-numeric
expression! You're a huge boon to the Evolt community, Ken.
--
Maximillian Von Schwanekamp
Dynamic Websites and E-Commerce
NeptuneWebworks.com <http://www.neptunewebworks.com/>
voice: 541-302-1438
fax: 208-730-6504
More information about the thelist
mailing list