Selects all qualities from quality by name, filtering out only the type of DataQuality which are used at least once in data_quality. In PHP:
function allUsed() {
// this query selects only the data qualities that are actually used at least once
$sql = '
SELECT `q`.`name`, count(*) AS `number`
FROM `quality` `q`, `data_quality` `dq`
WHERE `q`.`type`= "DataQuality"
AND `q`.`name` = `dq`.`quality`
GROUP BY `q`.`name`';
return $this->query( $sql );
}
This begs the question: why not querySELECT DISTINCT(quality) FROM data_quality;? The returned number is never used as far as I can tell.
As far as Jan is aware, the count is never used. Using the distinct query is fine. He does not know why there is a distinction on used qualities vs defined qualities.
Selects all qualities from
quality
byname
, filtering out only thetype
ofDataQuality
which are used at least once indata_quality
. In PHP:This begs the question: why not query
SELECT DISTINCT(quality) FROM data_quality;
? The returnednumber
is never used as far as I can tell.