将varchar值转换为int时转换失败

时间:2019-02-13 07:37:09

标签: sql

早晨, 谁能告诉我在哪里应该转换以下显示的错误以使查询运行?我真的很难理解如何解决此问题,请帮忙。

谢谢

SELECT ORDERS.CDRS_ORDER_ID, TERMINAL_NAME, ORDERS.LOADING_TERMINAL_ID, ORDERS.SUPPLIER_NUMBER,  SUPPLIER_PRODUCT.NAME AS SUPPLIER_PRODUCT_NAME,
SUPPLIER_PRODUCT.PRODUCT_NUMBER AS SUPPLIER_PRODUCT_NUMBER, ORDERS.CUSTOMER_NUMBER, CUSTOMER.NAME AS CUSTOMER_NAME,


FOLIO_HISTORY.FOLIO_NUMBER AS FOLIO_NUMBER, MOVEMENT_NUMBER AS ORDER_MOVEMENT_NUMBER, ORDERED_QUANTITY, 
NET_QUANTITY, FORMAT(FOLIO_HISTORY.OPEN_DATE ,'yyyy-MM-dd') AS FOLIO_OPEN_DATE, 

FORMAT(FOLIO_HISTORY.CLOSE_DATE ,'yyyy-MM-dd') AS FOLIO_CLOSE_DATE,
STATUS,  FORMAT(TERM_START_LOAD_TIME ,'HH') as TERM_START_LOAD_TIME, 
FORMAT(TERM_END_LOAD_TIME ,'HH') as TERM_END_LOAD_TIME FROM ORDERS 

inner JOIN SUPPLIER_PRODUCT ON ORDERS.SUPPLIER_NUMBER = SUPPLIER_PRODUCT.supplier_number 
inner JOIN TERMINAL_OWNER ON ORDERS.LOADING_TERMINAL_ID = TERMINAL_OWNER.TERMINAL_ID
inner JOIN FOLIO_HISTORY ON ORDERS.FOLIO_NUMBER = FOLIO_HISTORY.FOLIO_NUMBER and FOLIO_HISTORY.Terminal_ID = ORDERS.LOADING_TERMINAL_ID
inner JOIN ORDER_LOADED ON ORDERS.CDRS_ORDER_ID = ORDER_LOADED.CDRS_ORDER_ID and ORDER_LOADED .PRODUCT_NUMBER=SUPPLIER_PRODUCT.PRODUCT_NUMBER
inner JOIN CUSTOMER ON ORDERS.CUSTOMER_NUMBER = CUSTOMER.CUSTOMER_NUMBER and ORDERS.CUSTOMER_NUMBER = CUSTOMER.NAME

1 个答案:

答案 0 :(得分:0)

这是因为您在上一个联接中联接的列错误。 Order.CustId =名称?

  and ORDERS.CUSTOMER_NUMBER = CUSTOMER.NAME