[Dbix-class] bugs? distinct SQL
Fayland Lam
fayland at gmail.com
Tue May 6 02:52:46 BST 2008
my @ips = $c->dbic_log->resultset('login_history')->search( {
}, {
select => [
{ distinct => [ 'user_id','IP' ] }
],
as => [ 'user_id','IP' ]
}
)->all;
will create SQL:
DBD::mysql::st execute failed: Operand should contain 1 column(s) [for
Statement "SELECT DISTINCT( user_id, IP ) FROM login_history me"]
which in mysql:
mysql> SELECT DISTINCT( user_id, IP ) FROM login_history limit 1;
ERROR 1241 (21000): Operand should contain 1 column(s)
mysql> SELECT DISTINCT user_id, IP FROM login_history limit 1;
+---------+----------------+
| user_id | IP |
+---------+----------------+
| 15538534 | 220.238.87.172 |
+---------+----------------+
1 row in set (0.18 sec)
with (), mysql will complaint. version is 5.0.24a.
any hint? Thanks.
--
Fayland Lam // http://www.fayland.org/
Foorum based on Catalyst // http://www.foorumbbs.com/
More information about the DBIx-Class
mailing list