Select Distinct
Acct, Model
>From TableName

What am I missing?

David Smith
IT Consultant

>>-----Original Message-----
>>From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-
>>bounces@xxxxxxxxxxxx] On Behalf Of midrange-l-request@xxxxxxxxxxxx
>>Sent: Monday, April 24, 2006 10:40 AM
>>To: midrange-l@xxxxxxxxxxxx
>>Subject: MIDRANGE-L Digest, Vol 5, Issue 852
>>from: steema@xxxxxxxxxxxxx
>>subject: RE: SQL basic questions
>>
>>I did what I needed the tedious way, 2 programs, 1 workfile.
>>
>>lets say you have an account.
>>
>>12806  it has stores and models
>>acct    store    model
>>12806   0001     AAA
>>12806   0002     AAA
>>
>>I just want 12806 AAA don't care about the store.
>>
>>I would rather do this in one SQL statement.
>>
>>> How do you expect to pick the one model to display?
>>>
>>> Easiest would be to use min/max
>>>
>>> Select acct, min(model) from mytable
>>> Group by acct
>>>
>>> If you want the "first" model with a given account, that would be
harder
>>> to do but it can be done.  The key would be determining the
definition
>>> of first you want to use.
>>>
**************


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.