Problem with calculated fields
Posted: 2020-04-13 18:47
hi,
I'm using a calculated field in order to show the number of children a record has.
I have 2 tables:
- Parent: f_cont_improv_nonconformities
- Child: f_cont_improv_remedial_action
I'm using this query:
SELECT COUNT(*) FROM `f_cont_improv_nonconformities`
LEFT JOIN `f_cont_improv_remedial_action` ON `f_cont_improv_remedial_action`.`nonconformity_id`=`f_cont_improv_nonconformities`.`ID`
WHERE `f_cont_improv_nonconformities`.`ID`='%ID%'
the result is that when the parent has one or more children the query drops the correct result but... when there is no children... the query drops always the result: 1.
Any idea?
I'm using a calculated field in order to show the number of children a record has.
I have 2 tables:
- Parent: f_cont_improv_nonconformities
- Child: f_cont_improv_remedial_action
I'm using this query:
SELECT COUNT(*) FROM `f_cont_improv_nonconformities`
LEFT JOIN `f_cont_improv_remedial_action` ON `f_cont_improv_remedial_action`.`nonconformity_id`=`f_cont_improv_nonconformities`.`ID`
WHERE `f_cont_improv_nonconformities`.`ID`='%ID%'
the result is that when the parent has one or more children the query drops the correct result but... when there is no children... the query drops always the result: 1.
Any idea?