Subject Re: [firebird-support] Left join with containing condition
Author Kjell Rilbe
Den 2011-06-10 22:18 skrev Roland Turcan såhär:
> Hi all,
>
> I have two tables which I need to join them over containing condition.
>
> This command doesn't join the tables using that condition:
>
> select a.*, b.*
> from zzz_ukony a
> left join zzz_doc b on b.filename containing a.cs||'.';
>
> but for test these commands work fine and return what I am looking for:
>
> select * from zzz_doc where filename containing '30017003.';
> select * from zzz_ukony where cs containing '30017003';
>
> What could be a problem?
>
> Firebird 2.1.4 Windows

Just a suspicion: is a.cs char or varchar?

If it's char, then zzz_ukony.cs || '.' will result in e.g.
'30017003 .', which probably cannot be found in any zzz_doc.filename
values.

If this is the case, perhaps cast to varchar and right-trim before
concatenation.

Kjell
--
--------------------------------------
Kjell Rilbe
DataDIA AB
E-post: kjell@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64