Orm DQL如何在子查询中使用max函数

Orm DQL如何在子查询中使用max函数,orm,doctrine-orm,dql,Orm,Doctrine Orm,Dql,我有两个名为geocaching和geocaching的表,现在我想构建与SQL中的此查询等效的DQL查询: SELECT g.id,g.name,g.long,g.lat,g.altitude,g.town, g.region, g.district, g.geocaching_countries_id, gc.image FROM geocaching g JOIN geocaching_countries gc ON geocaching_countries

我有两个名为geocaching和geocaching的表,现在我想构建与SQL中的此查询等效的DQL查询:

SELECT g.id,g.name,g.long,g.lat,g.altitude,g.town, g.region, 
       g.district, g.geocaching_countries_id, gc.image FROM geocaching g 
       JOIN geocaching_countries gc ON geocaching_countries_id=gc.id 
       WHERE g.long=(SELECT max(geocaching.long) FROM geocaching);
我是ORM的初学者,所以我需要你的帮助。 谢谢