What is the difference between these two quries why they returning two different count. can any one explain....
---1
select count(distinct (t.id)) FROM
(
select row_number() OVER (PArtition by s.sid order by s.sid)n, s.*
FROM sub s inner join payee p on s.sid= p.sid
where
s.status in ('A','B','C','D')
and s.productid in ('m','s')
and s.billingMethod='online'
) t where t.n=1
---2
select count(distinct (t.id)) FROM
(
select row_number() OVER (PArtition by s.sid order by s.sid)n, s.*
FROM sub s inner join payee p on s.sid= p.sid
) t where t.n=1
WHERE
s.status in ('A','B','C','D')
and s.productid in ('m','s')
and s.billingMethod='online'
http://ift.tt/11Y1wrq
No comments:
Post a Comment