"Hernan Eguiluz" <[EMAIL PROTECTED]>
wrote in message news:[EMAIL PROTECTED]
> The problem is that a
> query like this
>
>
> SELECT column1, column2 from TABLE WHERE column1 LIKE "%PATTERN%" or
> column2 LIKE "%PATTERN%"
>
>
> won't tell me what column matched the LIKE.
SELECT column1, column1 LIKE '%PATTERN%',
column2, column2 LIKE '%PATTERN%'
from mytable
WHERE column1 LIKE '%PATTERN%' or column2 LIKE '%PATTERN%';
The two new columns would contain 0 or 1.
If you don't want to repeat each pattern twice, you could try something
like this:
select column1, matches1, column2, matches2 from
(select column1, column1 LIKE '%PATTERN%' matches1,
column2, column2 LIKE '%PATTERN%' matches2
from mytable)
where matches1 or matches2;
Igor Tandetnik
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users