简体   繁体   中英

reporting services with as400, cant select union

I have a AS400 datasource. I want to union a select field. This union works with a SQL datasource, but not when using an ODBC driver connecting to the AS400.

I have a dropdown list parameter using this select statement:

SELECT a FROM tableb 
WHERE tableb.a = '0'
UNION   --The problem is the union.
SELECT '' AS Empty

End result should be: (but union will not work)

Empty
(a data)
(a data)
(a data)
.......etc

Error Message: Token was not valid. Valid tokens: , From Into.

DB2/400 requires a FROM table:

SELECT a FROM tableb 
WHERE tableb.a = '0'
UNION   --The problem is the union.
SELECT '' AS Empty FROM sysibm.sysdummy1

The SELECT after the UNION needs to be a complete SELECT statement. That means you need a FROM clause.

UNION
SELECT 'Empty' as Empty
FROM sysibm.sysdummy1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM