Advertisement
letu

Количество заявлений

Jul 1st, 2020
1,383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT fio, count(*)
  2. FROM(
  3. SELECT fio, fac_id, count(*) as kol
  4. FROM (
  5. SELECT entrant.surname || ' ' || entrant.name ||
  6. CASE WHEN entrant.patronymic IS NOT NULL THEN ' ' || entrant.patronymic ELSE '' END AS fio,
  7. speciality.faculty_id AS fac_id
  8. FROM entrant, allset, speciality
  9. WHERE entrant.delete='0'
  10. AND entrant.allset_id = allset.id AND allset.speciality_id = speciality.id) AS allfacs
  11. GROUP BY 1,2
  12. ) AS distfacs
  13. GROUP BY 1
  14. HAVING count(*)>1
  15. ORDER BY 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement