- Timestamp:
- 04/10/09 20:01:23 (15 years ago)
- Location:
- branches/1
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1
-
branches/1/lib/Vote/Model/Vote.pm
r155 r177 593 593 my $sth = $self->db->prepare( 594 594 q{ 595 select count(ballot.id), value from ballot left join ballot_item 596 on ballot.id = ballot_item.id where ballot.poll = ? and invalid = 'false' 595 select count(ballot.id), value from 596 (select ballot.id, coalesce(corrected, value) as "value" from ballot left join ballot_item 597 on ballot.id = ballot_item.id where ballot.poll = ? and (invalid = 'false'or invalid is null) 598 group by ballot.id, coalesce(corrected, value)) as ballot 597 599 group by value 598 order by count 600 order by count desc, value 599 601 } 600 602 ); … … 612 614 my $sth = $self->db->prepare( 613 615 q{ 614 select count(ballot.id), coalesce(corrected, value) as value615 from ballot join ballot_item616 on ballot.id = ballot_item.id where ballot.poll = ? and 617 (invalid = 'false' or invalid is null)618 group by coalesce(corrected, value)619 order by count desc 616 select count(ballot.id), value from 617 (select ballot.id, coalesce(corrected, value) as "value" from ballot join ballot_item 618 on ballot.id = ballot_item.id where ballot.poll = ? and (invalid = 'false'or invalid is null) 619 group by ballot.id, coalesce(corrected, value)) as ballot 620 group by value 621 order by count desc, value 620 622 } 621 623 );
Note: See TracChangeset
for help on using the changeset viewer.