[Dbix-class] union

Jess Robinson castaway at desert-island.me.uk
Fri Apr 27 07:27:12 GMT 2007



On Fri, 27 Apr 2007, Octavian Rasnita wrote:

> From: "Jess Robinson" <castaway at desert-island.me.uk>
>
>> >  Is it possible to do
>> >  select a, b, c from table_name
>> >  union select a, b, c from table2_name
>> > 
>> >  using DBIx::Class?
>> > 
>> >  Thanks.
>> >
>>
>>
>>  Yes, it is.
>>
>>  Jess
>
> And where can I read how to do it?
>
> I have searched for "union" in more POD docs but I couldn't find that word.
>


You have to cheat a little:

   ->search({},
            { -order_by => \'col UNION ALL SELECT 1,2,3 FROM othertable' }
           );

.. just add it in a scalar ref to whichever your last attribute is (last 
SQL-wise that is)

Jess




More information about the Dbix-class mailing list