Page 1 of 1

Error nuRunQuery (Browse)

Posted: Fri Dec 13, 2019 10:54 am
by mariri
Hi guys !

In a browse, the SQL code is :

SELECT
p.foyer_key,
p.personne_nom,
p.personne_prenom,
t.finSejour
FROM personne p
INNER JOIN titre_sejour s ON s.titre_sejour_personne_id = p.personne_id
INNER JOIN (SELECT titre_sejour.titre_sejour_personne_id, MAX(titre_sejour.titre_sejour_date_fin) as finSejour FROM titre_sejour GROUP BY titre_sejour.titre_sejour_personne_id) t ON t.finSejour = s.titre_sejour_date_fin
WHERE
t.finSejour>= NOW()
AND
TIMESTAMPDIFF(WEEK, NOW(), t.finSejour)<=2
ORDER BY
t.finSejour ASC


But when I open the browse form, there is no result. In the debug results, I have this following error message
Why the part "GROUP BY titre_sejour.titre_sejour_personne_id) t ON t.finSejour = s.titre_sejour_date_fin WHERE t.finSejour>= NOW() AND TIMESTAMPDIFF(WEEK, NOW(), t.finSejour)<=2" is duplicated ? How do we fix it ?

Thanks !

Re: Error nuRunQuery (Browse)

Posted: Fri Dec 13, 2019 11:18 am
by kev1n
I think you will either have to create a view or a temporary table (see here: https://forums.nubuilder.cloud/viewtopic. ... _ID#p19457) since nuBuilder cannot handle complex queries