SQL Rows在过去10小时内更新

时间:2013-12-09 08:54:52

标签: mysql sql

我的表结构如下所示:

Table: Employee

<br><br>
<pre>
  <tr>
    <td>EName</td>
    <td>EId</td>
    <td>DeptNo</td>
    <td>DOJ</td>
  </tr>
  <br>
  <tr>
    <td>X</td>
    <td>1</td>
    <td>1</td>
    <td>12/9/2013 2:47:35 AM</td>
  </tr>
  <br>
  <tr>
    <td>Y</td>
    <td>2</td>
    <td>2</td>
    <td>12/9/2013 2:47:35 PM</td>
  </tr>
  <br>
  <tr>
    <td>Z</td>
    <td>3</td>
    <td>3</td>
    <td>12/9/2013 8:25:45 AM</td>
  </tr>
  <br>
  <tr>
    <td>-</td>
    <td>-</td>
    <td>-</td>
    <td>-</td>
  </tr>
  <br>
</pre>
.... 
<br>

我需要获取最近10小时加入的员工姓名......我该怎么做?

1 个答案:

答案 0 :(得分:0)

这可能会起作用

SELECT ENAME FROM EMPLOYEE 
WHERE 
HOUR(TIMEDIFF(DATE_SUB(NOW(),INTERVAL 10 HOUR),NOW())) <= 10