i am trying to build a view that should look like this:
CREATE OR REPLACE VIEW TestView AS
SELECT
p.name,
?? (select count(*) from Test t where t.currentstate in ('Running', 'Ended') and t.ref = p.key) as HasValues
from ParentTable p
I want the column HasValues to bei either 1 or 0. 1 if the count on the current state is > 0.
Can someone tell me how to do this? Thanks