Hallo,
i am searching for help here… was using this little mess query like below.
it is giving right result, the problem is paging is not working. on second page its giving me same result again and again.
Can someone Help me here please. Thank you
Angebote::findBySql('query‘)
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pageSize' => 10,
],
]);
SELECT *,
(SELECT ACOS(SIN(RADIANS('Userlat')) * SIN(RADIANS(lat))
+ COS(RADIANS('Userlat')) * COS(RADIANS(lat)) * COS(RADIANS(lng)
- RADIANS('Userlng'))) * 6371 AS distance
FROM profile_filialen AS pf
LEFT JOIN angebot_filialen AS af ON af.filialen_id = pf.id
WHERE af.angebot_id = aa.id
ORDER BY distance LIMIT 1) distance
FROM angebote AS aa
WHERE von < UNIX_TIMESTAMP()
AND bis > UNIX_TIMESTAMP()
AND status = 1
HAVING (distance < 'umkreis'
OR distance <= aa.radius
OR ONLINE = 1)