Subject | Re: DISTINCT on only one field? |
---|---|
Author | Alexander V.Nevsky |
Post date | 2003-04-28T18:06:42Z |
--- In ib-support@yahoogroups.com, Joe Martinez <joe@j...> wrote:
For Select Distinct Address, Zip
...
Into :Address, :Zip
Do
begin
Select First 1 Name, City, State ...
...
Where Address=:Address And Zip=:Zip
Into ...
Suspend;
end
Best regards, Alexander V.Nevsky.
> Here's my situation:Address and
>
> I have a table with addresses:
>
> Name
> Address
> City
> State
> Zip
>
> I want to do a select that only picks up distinct values of the
> Zip fields, but I want the select to include the rest of the fields.If
> the same value pair of Address and Zip appears more than once, Ionly want
> one of the records, even if the rest of the fields differ. I don'tcare
> which one of the records I get.Joe, I recommend to think about selectable stored procedure like
For Select Distinct Address, Zip
...
Into :Address, :Zip
Do
begin
Select First 1 Name, City, State ...
...
Where Address=:Address And Zip=:Zip
Into ...
Suspend;
end
Best regards, Alexander V.Nevsky.