Tuesday, January 16, 2007

Remove dup pixpair

remove_dup_pixpair
select pic_id, sum(pic_votes) as votes from

(
select pic1_id as pic_id,
pic1_votes as pic_votes
from
pixpair p1

union

select pic2_id as pic_id,
pic2_votes as pic_votes
from
pixpair p2

) a
group by pic_id
12:45:29 am

sum of all pictures.total_votes should equal pixpair.total_votes
12:45:33 am
Travis
and then, i sum this.
select sum(votes) from
(

select pic_id, sum(pic_votes) as votes from

(
select pic1_id as pic_id,
pic1_votes as pic_votes
from
pixpair p1

union

select pic2_id as pic_id,
pic2_votes as pic_votes
from
pixpair p2

) a
group by pic_id

)b
sum
-------
11622
and that gives a differnt number still.

No comments: