Welcome Guest, Not a member yet? Register   Sign In
mysql union all?
#3

[eluser]Evil Wizard[/eluser]
Code:
$objQuery = Doctrine_Query::create()
                              ->select('id, user_id, music_id, comment, createdat')
                              ->from('tbl_user_music_comment c')
                              ->where('UNION ALL
SELECT null AS id, user_id, music_id, null AS comment, createdat FROM tbl_user_music_like
UNION ALL
SELECT null AS id, user_id, music_id, null AS comment, createdat FROM tbl_user_music_listen
UNION ALL
SELECT null AS id, user_id, music_id, null AS comment, createdat FROM tbl_user_music_download
UNION ALL
SELECT null AS id, user_id, music_id, null AS comment, createdat FROM tbl_user_music_playlist
UNION ALL
SELECT null AS id, user_id, music_id, null AS comment, createdat FROM tbl_user_music_recommend')
                               ->orderBy('createdat DESC')
                               ->execute();
that should do it for use in DQL but you may have to tweak the field/table names to reflect how Doctrine sees them


Messages In This Thread
mysql union all? - by El Forum - 05-27-2009, 05:44 AM
mysql union all? - by El Forum - 05-27-2009, 05:46 AM
mysql union all? - by El Forum - 05-27-2009, 06:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB