Hi Igor, Thank you very much, it working :-)
Cheers, 2008/2/13, Igor Tandetnik <[EMAIL PROTECTED]>: > > "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 > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- Li YuQian Your Astfin team ___________________________________ uClinux/Asterisk distribution for Blackfin CPU http://www.ucpbx.com http://astfin.org http://sourceforge.net/projects/astfin/ ___________________________________ _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users