title: Can someone check for me where I did wrong?
body: <pre><code>select s1.emp_no as emp_no,(s1.salary - e1.salary) as growth from (
  select salaries.emp_no,salary from salaries
  where from_date in (select to_date from salaries)
  and to_date = '9999-01-01') as s1
  inner join (
  select e.emp_no,s.salary from employees as e
  left join salaries as s
  where e.hire_date = s.from_date) as e1
  on s1.emp_no = e1.emp_no
  order by growth
  </code></pre>
  <p>Hi guys, I'm new to sql and doing exercise from a website right now(similar to leetcode)
  about one question, above is my code and it works fine when I test it.
  However, on the website it says my code is wrong:</p>
  <pre><code>SQL_ERROR_INFO: &quot;You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where e.hire_date = s.from_date) as e1\non s1.emp_no = e1.emp_no\norder by growth' at line 8&quot;
  </code></pre>
  <p>I have no idea where I did wrong, can someone help me please?</p>
  <p>Thanks in advance!</p>
  <p>P.S if someone wants to test it self, below is the table:</p>
  <pre><code>drop table if exists  `employees` ; 
  drop table if exists  `salaries` ;
  CREATE TABLE `employees` (
  `emp_no` int(11) NOT NULL,
  `birth_date` date NOT NULL,
  `first_name` varchar(14) NOT NULL,
  `last_name` varchar(16) NOT NULL,
  `gender` char(1) NOT NULL,
  `hire_date` date NOT NULL,
  PRIMARY KEY (`emp_no`));
  CREATE TABLE `salaries` (
  `emp_no` int(11) NOT NULL,
  `salary` int(11) NOT NULL,
  `from_date` date NOT NULL,
  `to_date` date NOT NULL,
  PRIMARY KEY (`emp_no`,`from_date`));
  INSERT INTO employees VALUES(10001,'1953-09-02','Georgi','Facello','M','2001-06-22');
  INSERT INTO employees VALUES(10002,'1964-06-02','Bezalel','Simmel','F','1999-08-03');
  INSERT INTO salaries VALUES(10001,85097,'2001-06-22','2002-06-22');
  INSERT INTO salaries VALUES(10001,88958,'2002-06-22','9999-01-01');
  INSERT INTO salaries VALUES(10002,72527,'1999-08-03','2000-08-02');
  INSERT INTO salaries VALUES(10002,72527,'2000-08-02','2001-08-02');
  </code></pre>