Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

asked on

incorrect syntax near the keyword 'as'

Msg 102, Level 15, State 1, Line 3
Incorrect syntax near '.'.
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'as'.
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'as'.
SELECT p.productid, p.titleinternal,p.ebaytitle, p.model, p.mpn
, p.internalsku1, p.internalsku2,p.internalsku3p.inwarehouse1
,p.auk1,p.ny1,p.ourinwarehouse1,p.sentquantity1,p.cost1,p.skucount1 
,p.inwarehouse2,p.auk2,p.ny2,p.ourinwarehouse2,p.sentquantity2,p.cost2,p.skucount2 
,p.inwarehouse3,p.auk3,p.ny3,p.ourinwarehouse3,p.sentquantity3,p.cost3,p.skucount3 
,p.inwarehouse4,p.auk4,p.ny4,p.ourinwarehouse4,p.sentquantity4,p.cost4,p.skucount4
,p.asin,sd.accessories as accessories,sd.pyxisprice as price, sd.pathid as pathid
, datalength(sd.features) as fl, datalength(sd.specifications) as sl
, datalength(sd.itemincludes) as il, datalength(sd.ebaydescription) as ed
, (SELECT COUNT(*) FROM productspecifics WHERE productid = p.productid) as specs
, (SELECT COUNT(*) FROM productimages WHERE productid = p.productid) as imgs 
FROM products p 
left join sitedata sd 
  on p.productid = sd.productid 
WHERE p.folderid = '' 
AND p.active = '1' 
ORDER BY titleinternal

Open in new window

Avatar of Coralie Crumrine
Coralie Crumrine
Flag of United States of America image

Looks like you need a space
You have:
p.skucount4 p.asin,sd.accessories as accessories,

and it should be
p.skucount4 as in,sd.accessories as accessories,
Avatar of patterned
patterned

SELECT p.productid, p.titleinternal,p.ebaytitle,p.model,p.mpn,p.internalsku1,p.internalsku2,
p.internalsku3,p.inwarehouse1,p.auk1,p.ny1,p.ourinwarehouse1,p.sentquantity1,p.cost1,p.skucount1,
p.inwarehouse2,p.auk2,p.ny2,p.ourinwarehouse2,p.sentquantity2,p.cost2,p.skucount2,
p.inwarehouse3,p.auk3,p.ny3,p.ourinwarehouse3,p.sentquantity3,p.cost3,p.skucount3,
p.inwarehouse4,p.auk4,p.ny4,p.ourinwarehouse4,p.sentquantity4,p.cost4,
p.skucount4,p.asin,sd.accessories as accessories,sd.pyxisprice as price,sd.pathid as pathid, datalength(sd.features) as fl,
datalength(sd.specifications) as sl, datalength(sd.itemincludes) as il,datalength(sd.ebaydescription) as ed,
(SELECT COUNT(*) FROM productspecifics WHERE productid = p.productid) as specs,
(SELECT COUNT(*) FROM productimages WHERE productid = p.productid) as imgs

FROM products p left join sitedata sd on p.productid = sd.productid
WHERE p.folderid = '' AND p.active = '1' ORDER BY titleinternal


Try that?  Looks like you missed a couple commas.
ASKER CERTIFIED SOLUTION
Avatar of Nathan Riley
Nathan Riley
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgb192

ASKER

thanks