Site icon Dellen Directo

Error “‘CREATE VIEW’ must be the first statement in a query batch.” and “Incorrect syntax near ‘)’.”

I’m getting error in this below line,

CREATE VIEW reorder_view  
AS 
SELECT a.S_CODE AS S_CODE, 
       a.CODE AS CODE, 
       a.PRCT_TYPE AS PRCT_TYPE, 
       b.VENR_CODE AS VENR_CODE, 
       b.MATERAL_CODE AS MATERAL_CODE, 
       b.ORDER_LEVEL AS ORDER_LEVEL, 
       c.SUPPL_NAME AS SUPPL_NAME, 
       sum(a.QTY) AS TOTAL_QTY 
FROM  ((storage a 
       join supplier_items b) 
       join supplier_info c) 
WHERE  b.MATERAL_CODE = a.S_CODE 
AND    b.VENDR_CODE = c.VENDR_CODE 
GROUP BY a.S_CODE, 
         c.VENDR_CODE 
HAVING TOTAL_QTY <= b.ORDER_LEVEL ;

error msg:

‘CREATE VIEW’ must be the first statement in a query batch.,

Incorrect syntax near ‘)

Exit mobile version