Question: `tbl_LoanSummary` has `Sample_Number` column. I have to check if `Sample_Number` column is not null the return 'Y' otherwise return return 'N' from below select statement.

```
  select a.Br_Loan_No ,a.Br_LookupKey, //return  IsNull(s.Sample_Number) ='N' or 'Y'                            
  from dbo.tbl_Br a left outer join dbo.tbl_LoanSummary s 
  on s.Loan_no = a.Br_Loan_No order by a.Br_Loan_No

```

How to do this?

Answer: 
You can use the `case` expression for this...

```
select a.Br_Loan_No,
    a.Br_LookupKey,
    CASE WHEN s.Sample_Number IS NULL THEN 'N' ELSE 'Y' END AS [HasSample]
from dbo.tbl_Br a left outer join dbo.tbl_LoanSummary s 
on s.Loan_no = a.Br_Loan_No order by a.Br_Loan_No

```
In Oracle, you could also use 

`select NVL(s.Sample_Number, 'N')` 

to return N in case of null value

(of course you still need something to have Y in case of not null.)