how to use the subquery with in the case statement in mssql 2008
===

I need to change the following procedure if else statement into a single query using the select case statement with the subquery... 

     if((select COUNT(*) from pseb.dbo.meterattributedetails where meterid=@meterid)=0)
      select @emf=EMF from pseb.dbo.METERMASTER where MeterID=@meterid
      else  if((select COUNT(*) from pseb.dbo.meterattributedetails where meterid=@meterid and dateadd(day,1,@fromdate)<DateTime)>0) 
        select top 1 @emf=oldvalue from pseb.dbo.meterattributedetails  where MeterID=@meterid and dateadd(day,1,@fromdate)<datetime order by DateTime 
         else 
      select top 1 @emf=newvalue from pseb.dbo.meterattributedetails  where meterid=@meterid and DateTime<@fromdate order by DateTime desc


meterattribute table structure as like this:

    AttributeID	AttributeName	Oldvalue	newvalue	DateTime	meterid
    1	        EMF	        2.00000	        4.00000	       2012-07-05 	4756
    1	        EMF	        4.00000	        6.00000	       2012-07-10 	4756
    1	        EMF	        6.00000	        8.00000	       2012-07-15 	4756
    1	        EMF	        8.00000	       10.00000	       2012-07-25 	4756

in that table datetime refers the emf changed date, if my input is '2012-07-17' means i have to fetch he newvalue for that particular date,,, in between the july 15-25 the emf value is 8.00000. 
 