Yuri G <groovy...@gmail.com> wrote:
> This looks like a bug to me:
> 
> --sql:
> 
> CREATE TABLE t(a INTEGER);
> 
> INSERT INTO "t" VALUES(1);
> INSERT INTO "t" VALUES(2);
> INSERT INTO "t" VALUES(3);
> INSERT INTO "t" VALUES(4);
> 
> SELECT * FROM (
>  SELECT
>    a
>  FROM t
>  WHERE a<=2
>  ORDER BY a)
> 
> UNION ALL
> 
> SELECT * FROM (
>  SELECT
>    a
>  FROM t
>  WHERE a>2)
> 
> LIMIT 1;
> 
> --result:
> 1
> 3
> 4
> 
> --expected:
> 1

Looks like a bug to me, too.

> What I'm trying to do is get all names which match the search string. I need
> to show all names starting with search string and then show all other
> results which contain search string sorting results in each "group".

As a workaround, try something like this:

SELECT name FROM names
WHERE name LIKE '%a%'
ORDER BY name NOT LIKE 'a%', name;

-- 
Igor Tandetnik


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to