Question: I have a table `test1` and it has data as shown below:

![enter image description here](https://i.stack.imgur.com/x6E3F.png)

Now i don't want to select records where `days>0 in prod_year 2012` from `test1` table,so i used below query:

```
select * from test1
where id in (select id from test1 where pyear=2012 and 
(days<=0 or days is null)) OR id in (select id from test1 where pyear!=2012);

```

But when explained the above query its showing DEPENDENT SUBQUERY

![enter image description here](https://i.stack.imgur.com/vpeaY.png), 

is there any better way to write this query?

Thanks in advance.

Answer: 
This should do the job:

```
select * from test1 where (pyear=2012 and (days<=0 or days is null)) or pyear<>2012

```
```
select * from test1 where days > 0 && pyear >= 2012

```