[Dbix-class] Use of sub-select in joins

Jon Schutz jon+dbix at youramigo.com
Fri May 4 14:33:10 GMT 2007


On Fri, 2007-05-04 at 15:11 +0200, "Dieter Späth" wrote:
> 
> 
> Wouldn't it be easier with:
> 
> SELECT * 
> FROM EVENTS t1 
> WHERE t1.event_type = 'START'
>   AND t1.date <= xxx
>   AND NOT EXISTS (SELECT 0 
>                   FROM EVENTS t2 
>                   WHERE t1.date <  t2.date
>                     AND t2.date <= xxx 
>                     AND t2.event_type = 'STOP') 
> 

I think that would work, yes.  In which case using search_literal()
would get around the need for the table sub-select.  A good suggestion,
thankyou.

Though I am still interested in the other half of the problem - if I
_have_ to do a table sub-select in DBIx::Class, is the way I laid out
the "right" way...?

Thanks,

-- 

Jon



More information about the Dbix-class mailing list