Dan, Here are some ways to gather aggregates from your view:
SELECT loczipcode, dlrnum, MIN (distance) FROM viewname GROUP BY loczipcode, dlrnum SELECT loczipcode, COUNT (DISTINCT Dlrnum), MIN (distance) FROM ViewName GROUP BY loczipcode SELECT LocZipCode, COUNT (DISTINCT DlrNum), MIN (distance), AVG (distance), MAX (distance) FROM ViewName GROUP BY LocZipCode When your query gets what you want, you can INSERT INTO TABLENAME (<column list>) SELECT ... Bill On Wed, Jul 19, 2017 at 5:52 PM, Dan Goldberg <[email protected]> wrote: > Thx. I need to get the minimum distance and dlrnum by loczipcode. That is > the tricky part. > > > > Data example. > > > > Dlrnum distance loczipcode > > Abc 5 93535 > > Def 2 93535 > > > > > > > > > > Dan > > > > *From:* [email protected] [mailto:[email protected]] *On > Behalf Of *jan johansen > *Sent:* Wednesday, July 19, 2017 2:50 PM > *To:* [email protected] > *Subject:* Re: [RBASE-L] - get the minimum and store it > > > > INSERT INTO + > > mytable + > > SELECT distance, dlrnum, loczipcode, dlrzipcode + > > FROM myview > > > > -----Original Message----- > From: Dan Goldberg <[email protected]> > To: "[email protected]" <[email protected]> > Date: Wed, 19 Jul 2017 21:38:16 +0000 > Subject: [RBASE-L] - get the minimum and store it > > > I am drawing a blank. > > > > I have a view that has distance, dlrnum, loczipcode, dlrzipcode > > > > I want to extract the dlrnum, loczipcode, dlrzipcode from the view based > on the minimum distance and store it in a table. > > > > What would be the code to store it in a table? > > > > TIA > > > > Dan Goldberg > > > > > > -- > You received this message because you are subscribed to the Google Groups > "RBASE-L" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "RBASE-L" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "RBASE-L" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

