I have an SQL query that I was trying to translate into DQL. Seems like DQL does not like to use subquery in a FROM clause. Can you please guide me in the riqht direction?
SQL:
select count(x.remote_addr), ipc.country
from
(
select distinct(remote_addr) from update_feature_requests ufr
where ufr.request_datetime BETWEEN '2015-05-14' AND '2015-05-15'
)
as x
join ip_geolocation_cache ipc ON ipc.ip_address = x.remote_addr
group by ipc.country;
DQL:
$dql = "select
count(x.remoteAddr), ipc.country
from
(
select distinct(remoteAddr) from " . UpdateFeatureRequest::class . " ufr
where ufr.requestDatetime BETWEEN '2015-05-14' AND '2015-05-15'
)
as x
join " . IpGeolocationCache::class . " ipc ON ipc.ipAddress = x.remoteAddr
group by ipc.country";
Doctrine \ ORM \ Query \ QueryException HELP [Semantical Error] line 0, col 82 near '( ': Error: Class '(' is not defined.