"li yuqian" <[EMAIL PROTECTED]> wrote in
message
news:[EMAIL PROTECTED]
> now my sql working, but result different mysql result.
>
> sqlite> SELECT t.variable, t.value, ifnull(d.value, ''||'off') state
> FROM globals t LEFT JOIN globals d ON
> (substr(t.variable,5,length(t.variable)-4) =
> substr(d.variable,12,length(t.variable) - 11) and t.variable LIKE
> 'OUT\_%' ESCAPE '\' and d.variable LIKE 'OUTDISABLE\_%' ESCAPE '\')
> ORDER BY t.variable;
My bad. The condition on t must be out in the WHERE clause:
SELECT t.variable, t.value, ifnull(d.value, 'off')) state
FROM globals t LEFT JOIN globals d ON (
substr(t.variable,5, length(t.variable)-4) =
substr(d.variable,12, length(d.variable)-11) and
d.variable LIKE 'OUTDISABLE\_%' ESCAPE '\'
)
WHERE t.variable LIKE 'OUT\_%' ESCAPE '\'
ORDER BY t.variable;
Otherwise the result will always include all rows from t.
Igor Tandetnik
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users