Home > database >  For help! For help! A problem encountered in the work, please understand a great god to help me solv
For help! For help! A problem encountered in the work, please understand a great god to help me solv

Time:10-11


现在有一段sql,在mysql中运行正常,但现在要放在pgsql里面跑,有很多写法可能不一样,改了半天也没有运行出来,请懂pgsql的大神帮我改一下,看哪些写法是不支持在pgsql里的,以下是具体sql:
SELECT BASE.EBELN -- 1采购订单号 , BASE.EBELP -- 2采购订单行项目号 ,BASE.BUKRS -- 3公司代 , TOO1.BUTXT -- 4公司名称 , BASE.WERKS -- 5工厂 , TOO1W.NAME1 AS FACTORYNAME -- 6工厂名称 , BASE.MATNR -- 7物料编号 ,MAKT.MAKTX -- 8物料描述 , R057.ZZBJHBH -- 9招标计划编号,R057.ZXMLX -- 10项目类型,LEFT ( PROJ.PSPID, 12 ) AS PS_PSP_PNR -- 11项目编码, PROJ.POST1 -- 12项目描述,BASE.BANFN -- 13采购申请,BASE.BNFPO -- 14采购申请行项目,BASE.MENGE -- 15采购订单数量,BASE.MEINS -- 16计量单位,BASE.NETPR -- 17单价(不含税), CONCAT( FLOOR( T007V.KBETR/1000 * 100 ), '%' ) AS t007v -- 18税率,ROUND( BASE.NETPR * ( 1 + T007V.KBETR/1000 ), 2 ) AS netprprice -- 19单价(含税) ,BASE.NETWR -- 20总价(不含税),ROUND( BASE.NETWR * ( 1 + T007V.KBETR/1000 ), 2 ) AS netwrprice -- 21总价(含税),ekko.LIFNR -- 22供应商编码,lfa1.NAME1 AS SUPPLIERNAME -- 23供应商名称,
IF (R057 DDSXRQ='00000000', NULL, R057. DDSXRQ) AS DDSXRQ - 24 purchase order effective date, BASE. ZHTBH1-25 contract identifier, BASE. ZHTBH - 26 by the method of serial number,
CASE the WHEN BASE. KONNR="' THEN 'batch contract' ELSE 'agreement contract' END AS ZHTTYPE - 27 contract type,
BASE. ZTERM -- --? 28 payment proportion (associated dictionary data acquisition alone), WR AS zhtze - PO.NET? 29 contract amount,
IF (R057 EINDT='00000000', NULL, R057. EINDT) AS EINDT - 30 contract plan delivery date,
CASE BASE. ELIKZ WHEN "' THEN 'unfinished' ELSE 'completed' END AS ELIKZ -- 31 whether to complete delivery, EKET. WEMNG - 32 actual delivery quantity,
IF (EKBE BUDAT='00000000', NULL, EKBE. BUDAT) AS BUDAT - 33 actual delivery date,
The CASE WHEN RSEG. SHKZG_S & gt; RSEG. SHKZG_H THEN 'has been forwarded to vote' ELSE 'did not pay the tickets' END AS SHKZG - and whether to pay the ticket, CONCAT (LEFT (EKBE BUDAT, 6),' 25 ') AS ZZJGPRQ - 35 best hang ticket deadline,
The CASE WHEN RSEG. SHKZG_S & gt; RSEG. SHKZG_H THEN '-' the ELSE DATEDIFF (EKBE BUDAT, NOW ()) END AS sfpyjts - 36 days invoice early warning,
IF ((Y15X ZFKSQ3 & lt;> "), the 'is',' no ') AS ZFKXZ - 37 to whether payment application 1:0: no
-? 38 and payment for goods shall apply for the amount (2 * payment proportion in the total contract value, rounded to retain two decimal places),
IF ((Y15X ZFKSQ3 & lt;> . 'AND Y15X ZDJZT3=' C '), Y15X. ZSQFKJE3, ' ') AS zsqfkje - 39 actual payment amount to the payment for goods,
IF ((Y15X ZFKSQ3 & lt;> "), the IF (Y15X ZZFRQ3='00000000', NULL, Y15X. ZZFRQ3), ' ') AS ZZFRQ - 40 to payment date of actual payment,
IF ((Y15X ZFKSQ3 & lt;> '), Y15X ZDJZT3, ' ') AS ZDJZT - 41 pay state control,
IF ((Y15X ZFKSQ3 & lt;> "), the IF (Y15X. ZHXMZFJG3='C', 1, 0), ' ') AS ZHXMZFJG - 42 success pay to payment for goods 1:0: no,
IF ((Y15X ZFKSQ3 & lt;> "), DATE_ADD (DATE_ADD (CONCAT (LEFT (IF (EKBE BUDAT='00000000', NULL, EKBE. BUDAT), 6), '01), the INTERVAL 1 MONTH), the INTERVAL of 1 DAY),' ') AS ZZWZFRQ - 43 the late payment to the date of payment for goods,
IF ((Y15X ZFKSQ3 & lt;> "'), the IF (RSEG SHKZG_S & gt; RSEG SHKZG_H, '-', DATEDIFF (CONCAT (LEFT (EKBE BUDAT, 6), '25'), NOW ())), ' ') AS zdhyjts - 44 days to payment warning,
The IF (H035 KONNR IS NULL, 'no,' IS ') zsfty -- whether 45 powerstation H035. The awb TYD_ID - 46 shots,
IF (H035 ZZJRQ='00000000', NULL, H035. ZZJRQ) AS ZZJRQ_Y - 47 waybill creation date,
IF( H035.ZTYRQ='00000000', NULL, H035.ZTYRQ ) AS ZTYRQ_Y -- 48投运日期 , DATE_FORMAT( IF ( PROJ.ZSJTYSJ='00000000', NULL, PROJ.ZSJTYSJ ), '%Y%m%d' ) AS ZSJTYSJ_Y -- 49项目投运日期 , DATE_FORMAT(IFNULL( IF( PROJ.ZSJTYSJ='00000000', NULL, PROJ.ZSJTYSJ ),DATE_ADD( IF ( EKBE.BUDAT='00000000', NULL, EKBE.BUDAT ), INTERVAL 10 MONTH ) ),'%Y%m%d' ) AS ZYTYRQ_Y -- 50应投运日期,IFNULL( DATEDIFF( IF ( PROJ.ZSJTYSJ='00000000', NULL, PROJ.ZSJTYSJ ), NOW( ) ), DATEDIFF( DATE_ADD( IF ( EKBE.BUDAT='00000000', NULL, EKBE.BUDAT ), INTERVAL 10 MONTH ), NOW( ) ) ) AS ZYYJTS_Y -- 51投运单预警天数,
IF ((Y15X ZFKSQ4 & lt;> "), the 'is',' no ') AS ZTYSFSQ_Y - whether to apply for 1:52 was put into operation is 0: no
-? 53 to the payment for goods shall apply for the amount (third * payment proportion in the total contract value, rounded to retain two decimal places),
IF ((Y15X ZFKSQ4 & lt;> '), Y15X ZSQFKJE4, ' ') AS ZSJFKJE_Y paragraph - 54 was put into the actual payment amount,
IF ((Y15X ZFKSQ4 & lt;> "), the IF (Y15X. ZHXMZFJG4='C', 1, 0), ' ') AS ZTYKSFZF_Y - whether to pay 1:55 was put into operation is zero: no,
IF ((Y15X ZFKSQ4 & lt;> "'), Y15X ZZFRQ4, ' ') AS ZZFRQ_Y - 56 operation of the actual payment date,
IF ((Y15X ZFKSQ4 & lt;> '), Y15X ZDJZT4, ' ') AS ZDJZT_Y - 57 pay state control,
IF ((H043. KONNR IS NULL AND H043. KTPNR IS NULL), 'no', 'IS') ZSFZB_Y - whether 58 warranty,
59 H043. ZZBDH AS ZZBDH_Y -- -- quality policy,
IF (H043 ZZJRQ='00000000', NULL, H043. ZZJRQ) AS ZZBJRQ_Y - 60 policy creation date,
IF (H043 ZZBRQ='00000000', NULL, H043. ZZBRQ) AS ZZBRQ_C - 61, quality assurance date Z013. ZZBRQ AS ZZBRQ_B - 62, is a guarantee of DATE_ADD (the IF (H035 ZTYRQ='00000000', NULL, H035. ZTYRQ), INTERVAL Z013. ZZBRQ MONTH) AS ZZBRQ_Y - 63, should guarantee date DATEDIFF (DATE_ADD (the IF (H035 ZTYRQ='00000000', NULL, H035. ZTYRQ), INTERVAL Z013. ZZBRQ MONTH), NOW ()) AS ZZBYJTS_Y - 64, quality policy warning days
IF ((Y15X ZFKSQ5 & lt;> "), the 'is',' no ') AS ZZBSFSQ_Y - 65 quality assurance whether to apply for the
-? 66 warranty shall apply for the amount (* payment proportion in the total contract value. 4, rounded to retain two decimal places),
IF ((Y15X ZFKSQ5 & lt;> "'), Y15X ZSQFKJE5, ' ') AS ZSJFKJE_B - 67 quality assurance model of the actual payment amount,
IF ((Y15X ZFKSQ5 & lt;> "), the IF (Y15X. ZHXMZFJG5='C', 1, 0), ' ') AS ZZBSFZF_Y - 68 quality assurance whether pay,
IF ((Y15X ZFKSQ5 & lt;> "), the IF (Y15X ZZFRQ5='00000000', NULL, Y15X. ZZFRQ5), ' ') AS ZZBZFRQ_Y - 69 quality assurance model of the actual payment date,
IF ((Y15X ZFKSQ5 & lt;> "'), Y15X ZDJZT5, ' ') AS ZDJZT_B - 70 control pay state
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related