您好我正在使用MYSQL TIMESTAMPDIFF获取两个时间戳之间的差异。 我可以从下面的查询中获取两个时间戳的值,如下所示。
SELECT
CONCAT(
tsc_document_status.tsc_accepted_Or_Created_date,
' ',
tsc_document_status.tsc_accepted_Or_Created_time
) AS dateA,
CONCAT(
tsp_filtered_data.uploaded_date,
' ',
tsp_filtered_data.uploaded_time
) AS dateB
FROM
tsp_filtered_data
INNER JOIN tsc_document_status ON tsp_filtered_data.Document_id = tsc_document_status.warehouse_transfer_note_id
WHERE
tsp_filtered_data.ESN = '23545692'
但是,如果我包括TIMESTAMPDIFF,它会创建一个未知字段'错误。
SELECT
CONCAT(
tsc_document_status.tsc_accepted_Or_Created_date,
' ',
tsc_document_status.tsc_accepted_Or_Created_time
) AS dateA,
CONCAT(
tsp_filtered_data.uploaded_date,
' ',
tsp_filtered_data.uploaded_time
) AS dateB,
TIMESTAMPDIFF(MINUTE, `dateA`, `dateB`)/60 AS DateDifferanceInHours
FROM
tsp_filtered_data
INNER JOIN tsc_document_status ON tsp_filtered_data.Document_id = tsc_document_status.warehouse_transfer_note_id
WHERE
tsp_filtered_data.ESN = '23545692'
如果我的结局有任何错误,请提出建议。