Need SQL query
Posted on 2011-02-18
I have a table which contains the column COL1 like below
I have an another table contains two column FROM_CODE and TO_CODE. The values of this column are same as table 1 values.
My requirement is, based on below conditions the value needs to be fetch in the query.
1) If FROM_CODE is equals to COL1 then query should return 0
2) If TO_CODE is equals to COL1 then query should return 1
3) if both FROM_CODE and TO_CODE is same as COL1 then don't display the data in the query.
Please let me know how is this done by SQL?