You might want to use a distinct => 1 which results into a group by sql.
-Alex -----Original Message----- From: Matt S Trout [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 06, 2008 8:47 PM To: DBIx::Class user and developer list Subject: Re: [Dbix-class] bugs? distinct SQL On Tue, May 06, 2008 at 09:52:46AM +0800, Fayland Lam wrote: > 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. Known bug. Patch and/or test welcome. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Director http://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/ _______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED] *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"* T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien Handelsgericht Wien, FN 79340b *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"* Notice: This e-mail contains information that is confidential and may be privileged. If you are not the intended recipient, please notify the sender and then delete this e-mail immediately. *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
_______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]
