Help with a selection

From: <paul(dot)malm(at)lfv(dot)se>
To: <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Help with a selection
Date: 2019-07-04 09:51:01
Message-ID: 785199B14156764C8EB14EF96CEDC44EE0C8EB@xw-exch03.lfv.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I have a column named col (varchar)

col could look like this
902930
902920
902900
903110
913210
913200
...
I would like to remove an object that doesn't end '00' and if there are objects that start with the same 4 charcters and ending with 00.
All objects ending with 00 shall remain.
All object not ending with 00 shall remain of there is no object starting with the same 4 characters and ending with 00

The result of the col table should be:
902900
903110
913200

903110 is not removed because there is no 903100
913210 is removed because there is a 913200
902930 and 902920 are removed because there is 902900

I hope you understand the logic , perhaps there is no logic in my explanation.
Thanks in advance,
Paul

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dirk Mika 2019-07-04 10:01:02 Re: Help with a selection
Previous Message Dirk Mika 2019-07-04 08:57:01 Re: Expression of check constraint