[Dbix-class] How to use a function on multiple fields?

Karl.Moens at marsh.com Karl.Moens at marsh.com
Wed Jan 10 07:57:32 GMT 2007


Dear list-members and DBIx::Class developers,

Can any of you enlighten me on the best way --if at all possible in 
DBIx::Class-- to "translate" the following SQLquery in a DBIx::Class 
structure?

SELECT STD(field1 + field2) FROM table WHERE field1 + field2 > 10

[STD is of course the standard deviation function, which is part of the 
MySQL function set]

As you will know, STD(field1) + STD(field2) <> STD(field  + field2), 
otherwise it would be too easy to apply the function to each field 
separately and then add them in my Perl script.

For the condition "field1 + field2 > 10", I have now coded it in raw SQL, 
but I wonder if there isn't a more DBIC-ish way.

Thanks and best regards!

Karl Moens
aka CountZero on Perlmonks.org




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This message and any attachments are confidential. If you have received 
this message in error please delete it from your system. If you require 
any assistance please notify the sender. Thank You.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



More information about the Dbix-class mailing list