ERROR [37000] [PxPlus][ODBC Driver]Expected lexical element not found: FROM
trying to push this code to workbench, can anyone help me how this can be pushed through workbench without having "ERROR [37000] [PxPlus][ODBC Driver]Expected lexical element not found: FROM"
select o.*, isnull(c.Qty,0) as CancelQty, isnull(s.Qty,0) as ShipQty
from
(
-- ORDERED --
SELECT ORS_ORDN, ORS_LINE, ORS_CHGN, Size, SUM(Qty) AS Qty, SizeLookupCol
FROM
(
select ORS_ORDN, ORS_LINE, ORS_STYP, ORS_CHGN, Size, Qty, SizeLookupCol = SUBSTRING(SIZE,7,2)
from 'oropns-Open Order Size Detail'
unpivot (Qty for Size in (ORS_OR1,ORS_OR2,ORS_OR3,ORS_OR4,ORS_OR5,ORS_OR6,ORS_OR7,ORS_OR8,ORS_OR9,ORS_OR10,ORS_OR11,ORS_OR12,ORS_OR13,ORS_OR14,ORS_OR15,ORS_OR16,ORS_OR17,ORS_OR18)) as A
) a
GROUP BY ORS_ORDN, ORS_LINE, ORS_CHGN, Size, SizeLookupCol
HAVING SUM(Qty) > 0
) o
left join
(
-- CANCELLED --
SELECT ORS_ORDN, ORS_LINE, ORS_CHGN, Size, SUM(Qty) AS Qty, SizeLookupCol
FROM
(
select ORS_ORDN, ORS_LINE, ORS_STYP, ORS_CHGN, Size, Qty, SizeLookupCol = SUBSTRING(SIZE,7,2)
from 'oropns-Open Order Size Detail'
unpivot (Qty for Size in (ORS_CN1,ORS_CN2,ORS_CN3,ORS_CN4,ORS_CN5,ORS_CN6,ORS_CN7,ORS_CN8,ORS_CN9,ORS_CN10,ORS_CN11,ORS_CN12,ORS_CN13,ORS_CN14,ORS_CN15,ORS_CN16,ORS_CN17,ORS_CN18)) as A
) a
GROUP BY ORS_ORDN, ORS_LINE, ORS_CHGN, Size, SizeLookupCol
HAVING SUM(Qty) > 0
) c
on o.ORS_ORDN = c.ORS_ORDN and o.ORS_LINE = c.ORS_LINE and o.SizeLookupCol = c.SizeLookupCol
left join
(
-- SHIPPED --
SELECT ORS_ORDN, ORS_LINE, ORS_CHGN, Size, SUM(Qty) AS Qty, SizeLookupCol
FROM
(
select ORS_ORDN, ORS_LINE, ORS_CHGN, Size, Qty, SizeLookupCol = SUBSTRING(SIZE,7,2)
from 'oropns-Open Order Size Detail'
unpivot (Qty for Size in (ORS_SH1,ORS_SH2,ORS_SH3,ORS_SH4,ORS_SH5,ORS_SH6,ORS_SH7,ORS_SH8,ORS_SH9,ORS_SH10,ORS_SH11,ORS_SH12,ORS_SH13,ORS_SH14,ORS_SH15,ORS_SH16,ORS_SH17,ORS_SH18)) as A
) a
GROUP BY ORS_ORDN, ORS_LINE, ORS_CHGN, Size, SizeLookupCol
HAVING SUM(Qty) > 0
) s
on o.ORS_ORDN = s.ORS_ORDN and o.ORS_LINE = s.ORS_LINE and o.SizeLookupCol = s.SizeLookupCol
Comments
-
Hello, Have you validated the query outside of workbench?
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 754 Beast Mode
- 61 App Studio
- 41 Variables
- 693 Automate
- 178 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive