[NBLUG/talk] OT - SQL query question

Troy Arnold troy at zenux.net
Mon Dec 5 12:57:16 PST 2005


On Mon, Dec 05, 2005 at 11:22:06AM -0800, Mark Street wrote:
> Hmmm, I tried that too and it does not work as expected.
> 
> I exported the db as text and created a MySQL database.
> 
> If I run the query as stated below I still do not get the distinct ADDR1 field 
> with the additional fields listed, if I run the query as  SELECT DISTINCT 
> ADDR1 from mydb I get the correct disctinct addresses from the ADDR1 
> field.... but of course I want the name, city, stat, zip fields as well.
> 
> Maybe my logic is not correct?

I think a simple GROUP BY clause will get you what you want (since it
doesn't seem you're particular about which specific rows with ADDR1 you
get back)

select * from table group by ADDR1

-troy





More information about the talk mailing list