I reading data from table through Qml + JS and I need to have 100 return is the query doesn't found data:
SELECT (CASE
WHEN pourcenthour < pourcentcycle AND pourcenthour < pourcentmonth THEN pourcenthour
WHEN pourcentcycle < pourcenthour AND pourcentcycle < pourcentmonth THEN pourcentcycle
WHEN pourcentmonth < pourcenthour AND pourcentmonth < pourcentcycle THEN pourcentmonth
ELSE 100
END) AS pourcent,
ata,
immatriculation
FROM part_log
WHERE removed = "false" AND immatriculation =? AND ata=?
ORDER BY pourcent DESC LIMIT 1
I try this:
SELECT IFNULL((CASE WHEN ... ELSE 100 END),100) AS pourcent, ...
I got error:
Cannot read property 'pourcent' of undefined
I try this:
SELECT IFNULL(SELECT (CASE WHEN ... ELSE 100 END) ,100) AS pourcent
I got this error:
Error: near "SELECT": syntax error Impossible d'exécuter l'instruction