mysql> select @rn := @rn + 1 as rownum, emp_no, dept_no, from_date, to_date -> from dept_emp, (select @rn := 0) a limit 20; +--------+--------+---------+------------+------------+ | rownum | emp_no | dept_no | from_date | to_date | +--------+--------+---------+------------+------------+ | 1 | 10001 | d005 | 1986-06-26 | 9999-01-01 | | 2 | 10002 | d007 | 1996-08-03 | 9999-01-01 | | 3 | 10003 | d004 | 1995-12-03 | 9999-01-01 | | 4 | 10004 | d004 | 1986-12-01 | 9999-01-01 | | 5 | 10005 | d003 | 1989-09-12 | 9999-01-01 | | 6 | 10006 | d005 | 1990-08-05 | 9999-01-01 | | 7 | 10007 | d008 | 1989-02-10 | 9999-01-01 | | 8 | 10008 | d005 | 1998-03-11 | 2000-07-31 | | 9 | 10009 | d006 | 1985-02-18 | 9999-01-01 | | 10 | 10010 | d004 | 1996-11-24 | 2000-06-26 | | 11 | 10010 | d006 | 2000-06-26 | 9999-01-01 | | 12 | 10011 | d009 | 1990-01-22 | 1996-11-09 | | 13 | 10012 | d005 | 1992-12-18 | 9999-01-01 | | 14 | 10013 | d003 | 1985-10-20 | 9999-01-01 | | 15 | 10014 | d005 | 1993-12-29 | 9999-01-01 | | 16 | 10015 | d008 | 1992-09-19 | 1993-08-22 | | 17 | 10016 | d007 | 1998-02-11 | 9999-01-01 | | 18 | 10017 | d001 | 1993-08-03 | 9999-01-01 | | 19 | 10018 | d004 | 1992-07-29 | 9999-01-01 | | 20 | 10018 | d005 | 1987-04-03 | 1992-07-29 | +--------+--------+---------+------------+------------+ 20 rows in set (0.00 sec) mysql>
时间: 2024-11-04 14:54:55