例如

 

if(activity_type="start", -1*timestamp, timestamp)

 

CASE     
   when activity_type="start" then    -1*timestamp     
   when activity_type="end"   then      timestamp 
end