Why just output part result in LeetCode ,But in local db all output?


  • 0
    L
    SELECT Department,
           name AS Employee,
           Salary
    FROM
      (SELECT e.id,
              d.name AS Department,
              e.name,
              e.salary
       FROM Department d
       JOIN Employee e ON d.id = e.DepartmentId 
       ORDER BY d.id,
                salary DESC)AS newT2,
    
      ( SELECT GROUP_CONCAT(salary) AS salaryCollection
       FROM
         (SELECT SUBSTRING_INDEX(GROUP_CONCAT(Distinct CONCAT(Salary,Department)
                                              ORDER BY d_id, Salary DESC),',', 3) AS salary
          FROM
            ( SELECT e.id,
                     d.name AS Department,
                     e.name,
                     e.salary,
                     d.id AS d_id
             FROM Department d
             JOIN Employee e ON d.id = e.DepartmentId 
             ORDER BY d.id,
                      salary DESC )AS newT
          GROUP BY Department ORDER BY d_id ) AS salaryT) AS salaryCollectionT
    
    WHERE FIND_IN_SET(CONCAT(Salary,Department), salaryCollection)
    

    19 / 20 test cases passed.

    Where is the err???


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.