I am a noob when it comes to SQL syntax.
I have a table with lots of rows and columns of course :P Lets say it looks like this:
AAA BBB CCC DD
use a case into the select and use in the where close a OR
something like this, I didn't tested it but it should work, I think...
select case when CCC='D' then 'test1' else 'test2' end, * from table where (CCC='D' AND DDD='X') or (CCC<>'D' AND DDD='X')