--
-- Host: localhost    Database: kfv.prod
-- ------------------------------------------------------


--
-- Final view structure for view `v_lehrgangsbelegung`
--

/*!50001 DROP VIEW IF EXISTS `v_lehrgangsbelegung`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v_lehrgangsbelegung` AS select `a`.`id_lehrgang` AS `id_lehrgang`,(select count(1) from `v_anmeldungen` where `v_anmeldungen`.`id_lehrgang` = `a`.`id_lehrgang` and `v_anmeldungen`.`status` = 'genehmigt') AS `anmeldungen`,(select count(1) from `v_anmeldungen` where `v_anmeldungen`.`id_lehrgang` = `a`.`id_lehrgang` and `v_anmeldungen`.`status` in ('angemeldet','bestätigt','genehmigt')) AS `alle_anmeldungen`,(select count(1) from `v_anmeldungen` where `v_anmeldungen`.`id_lehrgang` = `a`.`id_lehrgang` and `v_anmeldungen`.`status` in ('warteliste','warteliste-genehmigt','warteliste-bestätigt')) AS `warteliste` from `v_anmeldungen` `a` group by `a`.`id_lehrgang` */;



