ОШИБКА: оператор не существует: время без часового пояса> = bytea - PullRequest
0 голосов
/ 20 марта 2019

Я получаю ошибку, подобную этой

ERROR: operator does not exist : time without time zone >= bytea 
Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.

, когда я пытаюсь выполнить следующий sql в jiber hibernate

select sto.name AS store, 
       sum(odi.subtotal_price) AS sales, sum(odi.qty) AS qty_sold,
       ((sum(odi.subtotal_price))/(sum(odi.qty))) AS average, 
       min(CAST(ord.date_out AS date)) AS start_date,
       max(CAST(ord.date_out AS date)) AS end_date,
       concat(min(CAST(ord.date_out AS time)), ' - ', max(CAST(ord.date_out AS time))) as time,
       sum(odi.cost_of_good_sold*odi.qty) AS COGS, ((sum(odi.cost_of_good_sold*odi.qty))/(sum(odi.qty))) AS average_cogs,
       date_trunc('day', ord.date_out) AS trx_day
FROM trx_order_detail_item odi
LEFT JOIN trx_order AS ord on ord.id = odi.order_id
LEFT JOIN mst_store AS sto on sto.id = ord.store_id
WHERE sto.id = :store and ord.date_out between :date1 and :date2 
      and CAST(ord.date_out AS TIME) BETWEEN :hour1 AND :hour2 and ord.order_status_id IN :orderstatus and ord.void_status = :voidStatus
GROUP BY sto.name, date_trunc('day', ord.date_out)
ORDER BY date_trunc('day', ord.date_out)

ошибка существует в CAST(ord.date_out AS TIME) BETWEEN :hour1 AND :hour2, прежде чем я добавил, что она отлично работает любойпредложение для этого?

...