I have never posed in a group before forgive me if I am out of line with my
question.
I have a table called table1
With three fields: Field1, Field2, Field3
Here is my query but I get errors.
Any help work be great
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
union all
select field1,field2 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
) previous_5_white
union all
(select field1, field2 from ee_table1 where field2 = 'red' limit 1)
union all
select field1,field2 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 asc
) next_5_white
union all
select field1,field2 from
( select * from ee_table1
where field2 = 'blue' limit 1
and field1 > (select max(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 asc) a )
order by field1 asc
) previous_blue
Thanks in advance
Sticky
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users