[Dbix-class] How to combine columns in a search()

Will Hawes info at whawes.co.uk
Wed Feb 8 15:11:38 CET 2006


Maurice Height wrote:
> Hi
> 
> Many thanks for the reply to my previous post.
> I finally understood how to setup the arguments for a search()
> using SQL functions.
> 
> My question now is - How do I code the "close/low >= 1.02" part of the
> where clause in the following query?
> 
> SELECT code, day, open, close, volume
> FROM   history
> WHERE  day >= '2006-02-01' AND  day <= '2006-02-07'
>        AND volume > 100000 AND  close/low >= 1.02
> GROUP BY code
> 

I'm reasonably sure you can't do that with search(), because I don't 
think SQL::Abstract (which DBIC uses behind the scenes) supports it at 
present.

For the time being, or until someone clever suggests an alternative, I'd 
suggest looking at search_literal() as an alternative:

perldoc DBIx::Class::ResultSet



More information about the Dbix-class mailing list