Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 mysql 查询,但我不知道如何在 symfony2.0 中进行查询。
询问:
SELECT a.id, a.name, FROM `ms_musiccategory` a LEFT OUTER JOIN `ms_musiccategory` b ON a.parent_Id = b.id ORDER BY coalesce( b.name, a.name ) , a.name
$con = $this -> getEntityManager() -> getConnection(); $st = $con -> prepare(' SELECT a.* FROM `tablename` a LEFT OUTER JOIN `tablename` b ON a.parent_Id = b.id ORDER BY coalesce( b.name, a.name ) , a.name'); $st -> execute(); $list = $st -> fetchAll();