I am trying to compare two columns page_entry & exit_page if both true value of 1 then its a bounce.
Page_entry | exit_page | Bounce
1 1 true
0 1 false
etc etc ......
WHEN entry_page = exit_page
END as Bounce
WHERE entry_page = exit_page
SUM(IF Bouce = TRUE THEN 1 ELSE 0 END)/page_visit
Are you looking for something like this? :
select hit_id,visit_num, SUM (CASE entry_page WHEN exit_page THEN 1 ELSE 0 END)/page_visit as ratio FROM [dbo].[Primary] group by hit_id,visit_num,page_visit ;