[Dbix-class] Problem selecting distinct years from date column
Peter Rabbitson
rabbit+dbic at rabbit.us
Fri Jan 8 18:15:22 GMT 2010
matthew couchman (JIC) wrote:
> OK, my mistake. Here are the results of your script when run against our MySQL server:
>
> ...
> ok 25 - CDs created successfully
> SELECT YEAR( year ) FROM cd me GROUP BY year ORDER BY year:
> ok 26 - Years group successfully
> INSERT INTO cd ( artist, title, year) VALUES ( ?, ?, ? ): '1', 'Jesus Rap', '0-1-1'
> SELECT YEAR( year ) FROM cd me GROUP BY year ORDER BY year:
> ok 27 - Zero-year groups successfully
> SELECT YEAR( year ) FROM cd me WHERE ( ( year != ? AND year IS NOT NULL ) ) GROUP BY year ORDER BY year: '0'
Hmmm... this differs a bit from your example by having an ORDER BY. Please
try to run the updated tests (from trunk [1]), which now are *identical* to
what you are running. Also note that newer versions of DBIC do not consider
functions for inclusion into distinct. Just something to keep in mind when
you upgrade.
[1] http://dev.catalyst.perl.org/repos/bast/DBIx-Class/0.08/trunk/
More information about the DBIx-Class
mailing list