I’m new to using Dremio, I’m here looking for help.
I have the following problem.
I want to use the DIFF_DATE function, but before this function I am also using the LAG function.
When I try it with the LAG function, the software runs without any failure.
But when I add DIFF_DATE function the failure appears
I would like to know how to identify my fault in this consultation.
This is the query:
*SELECT STORE_NBR, ITEM_NBR, SELL_EACH_QTY, SELL_AVERAGE_QTY, SELL_DEVIATION_QTY, SELL_TREND_QTY, SELL_FCST_QTY, SELL_LATE_QTY, SELL_ERROR_QTY, SHIP_QTY, SHIP_ERROR_QTY, MUMD_ERROR_QTY, TOTAL_ERROR_QTY, SPOIL_QTY, SEND_PI_IND, SUSPEND_IND, STORE_ONHAND_ADJMT_QTY, DIMINISH_ONHAND_ADJMT_QTY, DROP_SALE_ONHAND_ADJMT_QTY, BOUNTY_ONHAND_ADJMT_QTY, FINAL_ONHAND_ADJMT_QTY, EXCLUDE_ONHAND_QTY, LAST_NIGHT_ONHAND_QTY, NEXTDAY_EST_ONHAND_QTY, ORDER_POINT_ONHAND_QTY, SAFETY_STOCK_ONHAND_QTY, LOW_SALES_POINT_QTY, BIN_ALRT, BIN_QTY, BIN_DYS_TO_WAIT, BIN_CNTR, BIN_DATE, LOGC_ACTVD, FNL_PRDCT_PI_QTY, CPI_ADJMT_QTY, BKRM_ADJMT_QTY, WHSE_RCVG_QTY, YEST_RCVG_PRBLM_FLG, INIT_TRNST_QTY, YTDY_TRNST_QTY, ACCUM_RCVD_QTY, RCVNG_CPLTN_FLG, CAST(REPORT_DATE as TIMESTAMP) AS REPORT_DATE, CAST(NEXT_DATE as TIMESTAMP) AS NEXT_DATE
( SELECT *, LAG(REPORT_DATE, 1)
ORDER BY “REPORT_DATE” ) NEXT_DATE,
DATE_DIFF (TIMESTAMP “REPORT_DATE”, TIMESTAMP “NEXT_DATE”) SALES_DATE
FROM UserArea.CAM.NonSecure.“CAM_replenishment”.Teradata.“K1_WM_VM.DLY_FRESH_ONHD_SNAPSHOT” LIMIT 5 ) nested_0* .