SELECT f.exch
FROM (
SELECT
CASE
WHEN sourcedesk IN ('GOBUS_NY',
'GOBUS_UK',
'PETRDAES',
'PEETRAD') THEN clientid
WHEN sourcedesk = 'AESLDN'
AND clientid != '' THEN clientid
ELSE owner
END AS aclient,
clientid AS client,
orderid AS gaotag,
exchange AS exch,
side AS side,
securityid AS sym,
cumulativequantity*executionprice AS value,
cumulativequantity AS qdone,
fillid AS gaftag,
executionexchangetimestamplcl AS xstamp,
executionprice AS lprice,
executionexchangeid AS xftag,
serverid AS srvid,
reasoncode AS rescode,
rootfillid AS rgaftag,
miccode AS miccode,
mifidtradeflags AS mifidtradeflags,
sourcedesk AS desk
FROM fillsastextdatestring
WHERE agoralocaltradedate = '190205'
AND exchange = 'VEX'
AND sourceservicename LIKE 'vexprod%'
AND securityid LIKE '%.%'
UNION ALL
SELECT
CASE
WHEN sourcedesk IN ('GOBUS_NY',
'GOBUS_UK',
'PETRDAES',
'PEETRAD',
'VEXSVC',
'LLSOR') THEN clientid
WHEN sourcedesk = 'AESLDN'
AND clientid != '' THEN clientid
ELSE owner
END AS aclient,
clientid AS client,
orderid AS gaotag,
exchange AS exch,
side AS side,
securityid AS sym,
cumulativequantity*executionprice AS value,
cumulativequantity AS qdone,
fillid AS gaftag,
executionexchangetimestamplcl AS xstamp,
executionprice AS lprice,
executionexchangeid AS xftag,
serverid AS srvid,
reasoncode AS rescode,
rootfillid AS rgaftag,
miccode AS miccode,
mifidtradeflags AS mifidtradeflags,
sourcedesk AS desk
FROM fillsastextdatestring
WHERE agoralocaltradedate = '190205'
AND sourceservicename IN ('SORUK',
'PRODSorBkFlr',
'PRODFixBkFlr',
'PRODFixBkFlr1',
'PRODFixBkFlr2',
'PRODSmgBkFlr',
'ECGaia2Agora')
AND owner NOT LIKE 'tree%'
AND securityid LIKE '%.%'
UNION ALL
SELECT
CASE
WHEN sourcedesk IN ('GOBUS_NY',
'GOBUS_UK',
'PETRDAES',
'PEETRAD',
'VEXSVC',
'LLSOR') THEN clientid
WHEN sourcedesk = 'AESLDN'
AND clientid != '' THEN clientid
ELSE owner
END AS aclient,
clientid AS client,
orderid AS gaotag,
exchange AS exch,
side AS side,
securityid AS sym,
cumulativequantity*executionprice AS value,
cumulativequantity AS qdone,
fillid AS gaftag,
executionexchangetimestamplcl AS xstamp,
executionprice AS lprice,
executionexchangeid AS xftag,
serverid AS srvid,
reasoncode AS rescode,
rootfillid AS rgaftag,
miccode AS miccode,
mifidtradeflags AS mifidtradeflags,
sourcedesk AS desk
FROM fillsastextdatestring
WHERE agoralocaltradedate = '190205'
AND securityid LIKE '%.%'
AND exchange = 'BENCHMKX'
AND sourceservicename LIKE 'BENCHM_%'
UNION ALL
SELECT
CASE
WHEN sourcedesk IN ('GOBUS_NY',
'GOBUS_UK',
'PETRDAES',
'PEETRAD',
'VEXSVC',
'LLSOR') THEN clientid
WHEN sourcedesk = 'AESLDN'
AND clientid != '' THEN clientid
ELSE owner
END AS aclient,
clientid AS client,
orderid AS gaotag,
exchange AS exch,
side AS side,
securityid AS sym,
cumulativequantity*executionprice AS value,
cumulativequantity AS qdone,
fillid AS gaftag,
executionexchangetimestamplcl AS xstamp,
executionprice AS lprice,
executionexchangeid AS xftag,
serverid AS srvid,
reasoncode AS rescode,
rootfillid AS rgaftag,
miccode AS miccode,
mifidtradeflags AS mifidtradeflags,
sourcedesk AS desk
FROM fillsastextdatestring
WHERE agoralocaltradedate = '190205'
AND sourceservicename = 'ECGaia2Agora'
AND owner NOT LIKE 'tree%'
AND exchange IN ('BATS',
'CHIX')
AND reasoncode = 'NT'
AND side = 'B'
UNION ALL
SELECT
CASE
WHEN sourcedesk IN ('GOBUS_NY',
'GOBUS_UK',
'PETRDAES',
'PEETRAD',
'VEXSVC',
'LLSOR') THEN clientid
WHEN sourcedesk = 'AESLDN'
AND clientid != '' THEN clientid
ELSE owner
END AS aclient,
clientid AS client,
orderid AS gaotag,
exchange AS exch,
side AS side,
securityid AS sym,
cumulativequantity*executionprice AS value,
cumulativequantity AS qdone,
fillid AS gaftag,
executionexchangetimestamplcl AS xstamp,
executionprice AS lprice,
executionexchangeid AS xftag,
serverid AS srvid,
reasoncode AS rescode,
rootfillid AS rgaftag,
miccode AS miccode,
mifidtradeflags AS mifidtradeflags,
sourcedesk AS desk
FROM fillsastextdatestring
WHERE agoralocaltradedate = '190205'
AND sourceservicename LIKE 'tars_%' ) AS f,
(
SELECT orderid AS gaotag,
serverid AS srvid,
securityidasentered AS enteredsym,
securityid AS sym,
rootorderid AS rgaotag,
timeinforce AS tif,
settletype AS settletype,
sourceservicename AS appl,
account AS acct
FROM ordersastextdatestring
WHERE agoralocaltradedate = '190205'
AND destinationdesk IN ('BENCHX',
'VEXSVC',
'SORMKT',
'MAIA',
'LLSOR',
'TARSSVC')) AS o,
where f.gaotag = o.gaotag
Приведенный выше запрос завершается ошибкой со следующей ошибкой в impala:
AnalysisException: синтаксическая ошибка в строке 4: не определено: где f.gaotag = o.gaotag ^ Обнаружено: WHERE Ожидается:ПО УМОЛЧАНИЮ, ИДЕНТИФИКАТОР, ВЫЗВАННЫЙ: Исключением: Синтаксическая ошибка
Я прошел по следующей ссылке cloudera: https://www.cloudera.com/documentation/enterprise/5-4-x/topics/impala_subqueries.html, но не смог выполнить эту работу.
Я новичок ви Sybase IQ и Imapala.