From: Sim Zacks <sim@compulab.co.il>
To: pgsql-sql@postgresql.org
Subject: join on a like
Date: Mon, 01 May 2006 12:14:21 +0200
Message-ID: <e34jl7$2c09$1@news.hub.org> (raw)
A friend suggested that I use the Like predicate as part of my join
condition and I was wondering if that was wise.
For example, I have a column that describes the level of an event.
There is A,B,C and then they can have children, such as AA,AB,BA,BB and
they can all have children as well.
So if I wanted to see all the children with their parents at every level
it would be:
select a.* from tbl1 a join tbl1 b on a.level like b.level || '%'
That would give me on one side A and on the other side A,AA,AB,AAAB,...
as well as AA and on the other side all of its children.
I'm just nervous about using a Like in a join.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: sim@compulab.co.il
Subject: Re: join on a like
In-Reply-To: <e34jl7$2c09$1@news.hub.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox