Is it possible to rewrite the following view so that the user had the possibility to parameterize the view using WHERE
clause (WHERE overlap > @param
, which is commented out below)? Is it possible at all? The where
clause should affect before the group by
clause.
I try to select from a table vl
and to match the rows (outer join) against rows from a statement, which counts in another table (vlda
).
CREATE VIEW dr AS
SELECT
vl.unique_object_id AS unique_object_id,
ifnull(vlda.detectioncount, 0) AS detectioncount,
vl.count AS labelcount,
(1.0*ifnull(vlda.detectioncount, 0) / vl.count) AS detectionrate,
vlda.evalround_id
FROM viewlabelcount vl
LEFT OUTER JOIN
(
SELECT
count() as detectioncount,
unique_object_id,
evalround_id
FROM viewlabeldetections_best
-- WHERE overlap > 0.5 -- is it possible to parametrize?
GROUP BY unique_object_id
) AS vlda
ON
vl.unique_object_id = vlda.unique_object_id