Subject Re: [firebird-support] Firebird 'like'
Author Dennis McFall
At 02:27 AM 6/28/2006, you wrote:
>Hi,
>
>I've recently converted an old application from Paradox to Firebird
>(using the BDE). I just ran across a problem with the following query:
>
>SELECT PR.Code AS VarCode, PR.Libelle AS Var, C.Variete AS CodeVar,
> C.Calibre AS Calibre, C.SousCalibre AS SousCalibre, Cal.OrdreTri,
> C.Categorie AS Categorie, Cat.OrdreTri
>FROM Corpsfac C
>JOIN Entetefa e ON e.code = c.code and e.adherent = c.adherent
>JOIN Produits PR ON PR.Code = C.Variete
>JOIN calibre cal on (c.calibre = cal.code and
> ((cal.souscalibre = '' and ((c.souscalibre is null) or (c.souscalibre =
>''))) OR
> c.souscalibre = cal.souscalibre))
>JOIN categor cat on (c.categorie = cat.code)
>WHERE e.Date_fact >= '01/01/01' AND e.Date_fact < ('01/01/10' + 1)
> AND C.Variete like '1AK'
>GROUP BY PR.Code, PR.Libelle, C.Variete, C.Calibre,
> C.SousCalibre, C.Categorie, Cal.OrdreTri, Cat.OrdreTri
>ORDER BY PR.Code, PR.Libelle, C.Variete, C.Calibre,
> Cal.OrdreTri, Cat.OrdreTri, C.Categorie
>
>This query returns no rows. If I change the "AND C.Variete like '1AK'"
>clause to "AND C.Variete = '1AK'", it returns the correct rows.


WHERE C.VARIETE LIKE '%1AK%'

or

WHERE C.VARIETE STARTING '1AK'


./dm