fix sql distinct
scalar_coerce('?int', 0) is 0, not None
Merge pull request #650 from mrocklin/sql-distinct

More sql fixes