[Dbix-class] Comparing two columns in a table

Chisel Wright chisel at herlpacker.co.uk
Thu Mar 29 11:09:20 GMT 2007


On Thu, Mar 29, 2007 at 11:23:32AM +0200, Matija Grabnar wrote:
> I want to select only those rows where the two columns are unequal.
> 
> select * from sometable where sometable.a != sometable.b;
> 
> Any ideas?

I've ended up using scalar-refs to do this - I haven't found any other
way:

 ->search(
   {
     a => \'!= b',
   }
 )

Chisel
-- 
Chisel Wright
e: chisel at herlpacker.co.uk
w: http://www.herlpacker.co.uk/

  Atheism is a religion, provided you also accept that
  NOT collecting stamps is a hobby.



More information about the Dbix-class mailing list