在下面的查询中遇到DATE_FORMAT(tbl_employee_main.commencement_date, '%e-%b-%Y') as week
的问题。在MySql中给出了所需的结果但是当我回想起.asp中的查询时,日期格式为12-Feb-02
而不是12-Feb-2002
。有什么建议 ?
query = "SELECT tbl_states.state_name as home_state, tbl_employment_category.category, DATE_FORMAT(tbl_employee_main.commencement_date, '%Y /%m') as Month, DATE_FORMAT(tbl_employee_main.commencement_date, '%e-%b-%Y') as week, tbl_employee_main.employee_id, TIMESTAMPDIFF(YEAR,tbl_employee_main.date_of_birth,Curdate()) as Age, TIMESTAMPDIFF(YEAR,tbl_employee_main.commencement_date,Now()) as Years_of_Service, tbl_employee_main.surname, tbl_employee_main.first_name, tbl_employee_main.preferred_name, tbl_employee_main.work_email, tbl_employee_main.gender, tbl_employee_main.date_of_birth, tbl_employee_main.suburb, tbl_employee_main.state_id, tbl_employee_main.postcode, tbl_employee_main.end_date, tbl_employee_main.mobile_phone, tbl_employee_main.work_phone, tbl_employee_main.home_phone, tbl_employee_main.personal_email, tbl_supervisor.employee_id AS supervisor_id, tbl_supervisor.surname AS supervisor_surname ,tbl_supervisor.first_name AS supervisor_first_name, tbl_supervisor.work_email as supervisor_email, tbl_employee_main.nok_surname, tbl_employee_main.nok_first_name, tbl_employee_main.nok_email, tbl_employee_main.nok_mobile "
query = query & "FROM employee.tbl_employee_main "
query = query & "INNER JOIN employee.tbl_employee "
query = query & "ON(tbl_employee.employee_id = tbl_employee_main.employee_id) "
query = query & "INNER JOIN employee.tbl_employment_category "
query = query & "ON(tbl_employment_category.category_id = tbl_employee.category_id) "
query = query & " AND(tbl_employment_category.category_id = 2 ) "
query = query & "INNER JOIN employee.tbl_employee_main AS tbl_supervisor "
query = query & "ON(tbl_supervisor.employee_id = tbl_employee.supervisor_id) "
query = query & "LEFT JOIN locale.tbl_states "
query = query & "ON(tbl_states.state_id = tbl_employee_main.state_id) "
query = query & "INNER JOIN employee.tbl_employment_status "
query = query & "ON(tbl_employment_status.status_id = tbl_employee_main.status_id) "
query = query & "WHERE(tbl_employment_status.status_considered_active = true) "
query = query & "ORDER BY tbl_employee_main.employee_id , tbl_employee_main.surname , tbl_employee_main.first_name "
set result = newQuery(query, DB_USER_REPORTING)