hi
hope this helps
solved = yes
why am i doing this ? .. much better easier to understand
Mateen please help me out and confirm this
;WITH x AS ( SELECT *, ROW_NUMBER() OVER(PARTITION BY trans_date ORDER BY time_portion) rn FROM @t WHERE status IN ('01','02') ) SELECT a.trans_date, CASE WHEN a.status='01' THEN a.time_portion END AS timein, ...