I have a working MS SQL query that extracts data from an MS SQL database into MS Excel and wish to migrate it to OpenOffice Calc.
I have placed double quotation marks around all field names but am getting annoying syntax error message that is useless to diagnose the problem. The query extracts data from multiple Wonderlister tables.
Any assistance that would indicate what is necessary in order to get (Libre)OpenOffice to accept it is appreciated.
Thanks.
Error: SQL Status: HY000
Error code: 1000
Syntax error in SQL statement
Query as follows:
Code: Select all
select distinct
a."eBayUserID",
a."ListingID",
i."ConsignorName",
j."SKU",
a."eBayItemID",
a."Title",
a."DaysActive",
a."StartTime",
a."EndTime",
a."CurrentPrice",
a."QuantityAvailable",
a."CurrentPrice"*a."QuantityAvailable" as "ExtendedValue",
c."CategoryName" as "EbayCategoryParent",
b."CategoryName" as "EbayCategory",
f."Name" as "StoreCategory1_Parent",
d."Name" as "StoreCategory1",
e."Name" as "StoreCategory2",
max(h."DateUploaded") as "max_DateUploaded",
max(h."CreationDate") as "max_CreationDate",
max(h."PictureLastModifiedOn") as "max_PictureLastModifiedOn"
FROM "WonderLister"."dbo"."Listing" a
LEFT JOIN "Wonderlister"."dbo"."eBayCategories" b
ON a."PrimaryCategoryID" = b."CategoryID"
LEFT JOIN "Wonderlister"."dbo"."eBayCategories" c
ON b."CategoryParentID" = c."CategoryID"
LEFT JOIN "Wonderlister"."dbo"."StoreCategories" d
ON a."eBayUserID" = d."eBayUserID" and
a."Storefront_StoreCategoryID" = d."CategoryID"
LEFT JOIN "Wonderlister"."dbo"."StoreCategories" e
ON a."eBayUserID" = e."eBayUserID" and
a."Storefront_StoreCategory2ID" = e."CategoryID"
LEFT JOIN "Wonderlister"."dbo"."StoreCategories" f
ON a."eBayUserID" = e."eBayUserID" and
d."ParentCategoryID" = f."CategoryID"
LEFT JOIN "wonderlister"."dbo"."ProductPictures" g
ON a."productId" = g."productid"
LEFT JOIN "wonderlister"."dbo"."Pictures" h
ON g."pictureid" = h."pictureid"
LEFT JOIN "WonderLister"."dbo"."Consignors" i
ON i."ConsignorID" = a."ConsignorID"
LEFT JOIN "WonderLister"."dbo"."Products" j
ON j."ProductID" = a."ProductID"
WHERE a."ListingStatus" = 'Active' and
a."DaysActive" >= 0 and
b."SiteID" = 'US' and
c."SiteID" = 'US'
group by
a."eBayUserID",
a."ListingID",
i."ConsignorName",
j."SKU",
a."eBayItemID",
a."Title",
a."CurrentPrice",
a."QuantityAvailable",
a."DaysActive",
a."Starttime",
a."EndTime",
c."CategoryName",
b."CategoryName",
f."name",
d."name",
e."name"
order by "DaysActive"