I am having difficulty writing a nested postgis query. I have a single table from which I need to create a view in PostgreSQL.
I have created the view with the following command
create view rrop08.rrop08_lws_f AS
select * from rrop08.rrop08_gk3_polygon
where planznr='04.01' OR planznr ='04.02';
The problem here is that the table contains another field called "bez". I need to carry out the first query but also with bez=0; so that none of the 04.01 or 04.02 rows have a bez value other than 0.
I have tried this...
create view rrop08.rrop08_lws_f AS
select * from rrop08.rrop08_gk3_polygon
where planznr='04.01' OR planznr ='04.02' AND bez=0;
but this retrieves all rows with bez=0 and not just the 04.01 or 04.02 ones. I need to first select 04.01 or 04.02 and then on this query get those with bez=0...ie.nested.
I´m a bit lost on how to do this.
THanks for any help,
Rob
