[Dbix-class] Re: search for equality between columns

Dagfinn Ilmari Mannsåker ilmari at ilmari.org
Sun Jun 17 18:52:12 GMT 2007


"Daniel McBrearty" <danielmcbrearty at gmail.com> writes:

> table has two integer columns:
>
> id1 INTEGER,
> id2 INTEGER
>
> sql query:
>
> SELECT COUNT(*) FROM table WHERE id1 = id2;
>
> how do I do this in dbix?

my $count = $schema->resultset('Table')->search({ id1 => \'= id2' })->count;

-- 
ilmari
"A disappointingly low fraction of the human race is,
 at any given time, on fire." - Stig Sandbeck Mathisen




More information about the Dbix-class mailing list