我想在同一天按日期和代码ASC订购以下查询: 例如在特定日期(按日期时间排序)和同一天按代码排序的所有票证。
我已经尝试过分组方式,但是它不起作用。
这是我的查询;
SELECT
tck_NRicevuta as ticket,
tck_dataOUT AS date_out,
tck_ID_tariffa AS code,
park_ticket.tck_importo AS ToTal
FROM
park_ticket
WHERE
tck_flaguscita = 'U'
ORDER BY
date_out, code
Query result: wrong!!- I'd want ordered by datetime and then by code in the same day
答案 0 :(得分:0)
您只能通过使用date()
上的date_out
来按日期对结果进行排序
SELECT tck_NRicevuta as ticket,
tck_dataOUT AS date_out,
tck_ID_tariffa AS code,
park_ticket.tck_importo AS ToTal
FROM park_ticket
WHERE tck_flaguscita = 'U'
ORDER BY date(date_out),code