"Webmaster" <[EMAIL PROTECTED]> wrote
in message news:[EMAIL PROTECTED]
> select field1, field2 from
> ( select * from ee_table1
>   where field2 = 'blue' limit 1
>   and field1 < (select min(field1) from (select  * from ee_table1
>                                       where field2 = 'white' limit 4
>                                       and field1 < (select field1 from
> ee_table1 where field2 = 'red' limit 1 ) order by field1 desc) a )
>   order by field1 desc
> ) previous_blue

You seem to misunderstand how LIMIT clause works. LIMIT applies to the 
query as a whole, not to individual conditions, and restricts the number 
of rows retuned by the statement. As such, it always appears at the end. 
E.g.

select field1, field2
from table1
where field2 = 'white'
limit 4;

returns up to four rows from the table that have field2 = 'white'.

What is your query supposed to achieve? Could you describe your goal in 
plain English?

Igor Tandetnik 



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

Reply via email to