I have following SQL code:
SELECT m.email
FROM members as m
WHERE exists
(
select *
from posts as p
where p.email = m.email
)
order by ads desc
I want to add another statement before “exists”, so that I have something like
SELECT m.email
FROM members as m
WHERE
(m.ads<>0)
and
exists
(
select *
from posts as p
where p.email = m.email
)
order by ads desc
but it doesn’t work, as well as ads<>'0', ads<>('0'), m.ads<>0 etc.
Why do you think it’s not working?
By “Doesn’t Work” I mean that when I add a line ‘ads<>0’ there is no change in query result (as if I did not enter this line).
If I add a line ‘ads=0’ instead – it gives out empty result, as if there are no fields which have a value of Zero (which actually do exist)
You should be able to add as many logical clauses to your
WHEREstatement as you wish.Assuming
members.adsis an integer data type…