Sample Header Ad - 728x90

Finding the errors in SQL and interpreting what the SQL codes mean

-4 votes
1 answer
129 views
Find all 5 errors in the SQL script below and explain what the script is trying to do select A.BIZ_DT, A.ACTL_PARENT_SVC_NUM, A.DIRCTN_IND, A.BUS_STOP_CD, A.BUS_STOP_ARRVL_TM, A.OPR_ID_NUM, A.REG_NUM, A.BUS_REGISTER_NO, A.TRIP_NUM, B.PSGR_CC_CNT, sum(A.BOARD_CNT) Board, sum(A.ALIGHT_CNT) Alight, A-B NetBoard NetBoard/B.PSGR_CC_CNT as Utilization from PLAP_VIEW_PTQ.V_OD_NET_ON_BOARD_SEP as A LEFT JOIN PLAP_TWM_USERSPACE_PTQ.BUs_fleet_2022 AS B A.BUS_REGISTER_NO=B.BUS_REGISTER_NO AND A.OPR_ID_NUM=B.OPR_ID_NUM where A.SVC_NUM in (147) where A.BUS_STOP_CD in(63199) and A.BIZ_DT='2022-01-04' and '2022-01-09' group 1,2,3,4,5,6,7,8,9,10 The errors that i managed to find are, A.SVC_Num which is wrongly written, '2022-01-09' is wrongly written, and the A-B netboard which is missing. Im still unable to find the remaining 2 errors and interpret what the SQL code above actually means. Could someone help explains. Thanks!
Asked by Wen Hui Wong (7 rep)
Mar 27, 2022, 08:17 AM
Last activity: Mar 27, 2022, 11:15 AM