Hi, 
     Here I have Queried you how to use ‘Exists’ in the select Statement. Inside ‘Select’ statement you cant use ‘IF EXISTS’ so we are going to replace it with ‘WHEN EXISTS’ both are going to work same and Example as follows below.


T_PRODUC and T_Delivery are the table names, we are checking Existance of Specified PID and LOCA, Check the Example Below

Example

SELECT OrderID,Price,
CASE
  WHEN EXISTS(SELECT * FROM T_PRODUC  where loca = 'Chennai' and PID=2 )
          THEN
          (
             'Yes' as Availability
           )
     ELSE
             'No' as Availability
     END,
ExpectedDeliveryDate From T_Delivery