Advertisement
Jgug

IOSY_Views_3_5

Oct 19th, 2014
527
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.64 KB | None | 0 0
  1. SELECT BNO, city, street, tel_no
  2. FROM(
  3.     SELECT A.*, B.bno, B.street, B.city, B.tel_no
  4.     FROM BranchVSHKL B, (
  5.         SELECT bno AS StaffBNO, COUNT(sno) AS Personnel
  6.         FROM StaffVSHKL
  7.         GROUP BY bno
  8.         ) A
  9.     WHERE Personnel = (
  10.         SELECT MAX(Personnel)
  11.             FROM
  12.             (
  13.                 SELECT bno AS StaffBNO, COUNT(sno) AS Personnel
  14.                 FROM StaffVSHKL
  15.                 GROUP BY bno
  16.             )
  17.         ) AND StaffBNO = B.bno
  18.     );
  19. /*
  20. BNO   CITY     STREET        TEL_NO
  21. ----- -------- ------------- ------------
  22. 1332  Minsk    Kabushkina    375296954454
  23. 1325  Minsk    Timiryazeva   375296545454
  24. 1346  Minsk    Pritytskogo   375296651754
  25. 1367  Grodno   Kirova        375296541004
  26. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement