SQL Query以降序返回日期

时间:2013-06-05 11:09:27

标签: sql phpmyadmin

我正在使用我的phpmyadmin,它与我们的CRM系统相连,我们可以从我们的数据库中提取报告。我正在尝试返回一个报告,其中日期将按降序排列 - 但我的查询似乎没有正确返回命令。

我的查询是:

SELECT emp.emp_firstname as `first name` 
     , emp.emp_lastname as `last name`
     , emp.emp_work_email as `email` 
     , emp.custom6 as `Agency` 
     , emp.employee_id as `crewcode` 
     , emp.custom67 as `nationality`
     , emp.custom14 as `Salary options`
     , emp.custom15 as `Salary options comments`
     , emp.custom17 as `Salary options date of change`
     , emp.custom30 as `Bank Cert` 
FROM `hs_hr_employee` emp  
WHERE emp.custom61 LIKE "active-oam" 
ORDER by emp.custom17 DESC

1 个答案:

答案 0 :(得分:0)

 SELECT emp.emp_firstname as `first name` 
 , emp.emp_lastname as `last name`
 , emp.emp_work_email as `email` 
 , emp.custom6 as `Agency` 
 , emp.employee_id as `crewcode` 
 , emp.custom67 as `nationality`
 , emp.custom14 as `Salary options`
 , emp.custom15 as `Salary options comments`
 , emp.custom17 as `Salary options date of change`
 , emp.custom30 as `Bank Cert` 
  FROM `hs_hr_employee` emp  
  WHERE emp.custom61 LIKE "active-oam" 
  ORDER by emp.custom17 DESC, emp.employee_id DESC

尝试一下