DISTINCT to get distinct *substrings*? - Mailing list pgsql-general

From Christoph Pingel
Subject DISTINCT to get distinct *substrings*?
Date
Msg-id DAEFA5F7-CC16-46E9-9157-705A15D04941@web.de
Whole thread Raw
Responses Re: DISTINCT to get distinct *substrings*?  ("Nikolay Samokhvalov" <samokhvalov@gmail.com>)
List pgsql-general
Hello to the list,

here's an SQL question, I hope it's not off topic. From a list of URLs I want to get only the distinct values of the *web sites* these URLs belong to, that is everything before and including the 3rd slash, and I think this should be possible within the DB. I would like to say something like

SELECT substring(attribute from '^http://[^/]*/') from pg_atp where attribute like 'http://%'

(which works) but get only the distinct values. SELECT DISTINCT ON substring.. doesn't work. Probably I haven't understood the semantics of the DISTINCT keyword. Can anybody help?

thanks in advance
Christoph

pgsql-general by date:

Previous
From: Joe Lester
Date:
Subject: restoring a backup, incompatible with server
Next
From: "Nikolay Samokhvalov"
Date:
Subject: Re: DISTINCT to get distinct *substrings*?