Complet Select stmt - not able to proceed
Hi Sql experts,
Please help me to resolve or give tips how to start on this.
the following are sample data in a table
I want an sql statement which displays only the records which
satisfies the following condn.
1.if type is 'BUS' and val = 1 and if type is FUN and date is null
2.if type is BUS and date is null and if type is FUN and val = 1
3.Do not fetch if type is BUS and val=1 and type is FUN and val=1
output for the table should be
num doc val date
--------------------
40 BUS 1 20080910
40 FUN 0 null
43 BUS 0 null
43 FUN 1 20080423
Sample data:
num doc val date
--------------------
40 BUS 1 20080910
40 FUN 0 null
41 BUS 0 20080910
42 BUS 0 20080713
42 FUN 1 null
43 BUS 0 null
43 FUN 1 20080423
44 BUS 1 null
44 FUN 1 null
45 BUS 1 20080722
45 FUN 1 null
46 BUS 1 20080923
46 FUN 0 20080722
47 FUN 1 null
I dont know how to perform two condition check in single query. please help.