我想在学说中使用联合,我搜索了很多但没有成功,这是我在 sql 中的联合查询,如何在学说中转换这个查询?
select * from (select orderid,tutorialId,points,allow_multiple,question,answer1,image1,correct1,answer2,image2,correct2,answer3,image3,correct3,answer4,image4,correct4,answer5,image5,correct5,'1' as istest,'' as content,'' as media,'' as media_type_id from tutorial_test
union
select orderid,tutorialId,'0' as istest,content,media,media_type_id,'' as points,'' as allow_multiple,'' as question,'' as answer1,'' as image1,'' as correct1,'' as answer2,'' as image2,'' as correct2,'' as answer3,'' as image3,'' as correct3,'' as answer4,'' as image4,'' as correct4,'' as answer5,'' as image5,'' as correct5 from tutorial_elements) a where a. tutorialId = 1 order by orderid asc
这是我的教义查询
$query = "SELECT * FROM(SELECT
tt.tutorialid
FROM
TutorialTest tt
UNION
SELECT te.tutorialid) tte
WHERE tte.tutorialid = 1
";
$qb = $this->Doctrine->createQuery($query);
$tutorial_test = $qb->getResult();
我进行了很多研究,但没有取得任何成功,如果有人可以提供帮助,在此先感谢数百万。