From: "Jess Robinson" <[EMAIL PROTECTED]>
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

Oh, I am not sure what I want to do is really possible. Or maybe I need to cheat a little more. :-)

I don't need just a union, but a union that looks like:

select a, b, c, 'var1' as v from table1
where d='value'
union select a, b, c, 'var2' as v from table2
where d='value'
order by a, b desc limit 0,20;

So I will need to put a where condition for each select, and an 'order by' at the end.

Is there another trick for doing this, or you think it is possible to put the entire SQL string as a value of the "select" parameter, like:

$rs->search({},{
select => \'sql string',
});

Thanks.

Octavian


_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to