6. zadatak

mail@pastecode.io avatar
unknown
mysql
a month ago
458 B
2
Indexable
Never
create view bendovi_sa_brojem_clanova as
select idBenda, datum1, datum2, 
	(
		select count(*)
        from sastav_benda s2
        where s1.idBenda = s2.idBenda AND (s1.datum1 <= s2.datum2 OR s2.datum2 IS NULL) AND (s2.datum1 <= s1.datum2 OR s1.datum2 IS NULL)
    ) as 'brojClanova'
from sastav_benda s1

select distinct(b1.idBenda)
from bendovi_sa_brojem_clanova b1
where b1.brojClanova = (
	select MAX(b2.brojClanova)
	from bendovi_sa_brojem_clanova b2
)
Leave a Comment