on 2018 Feb 08 2:46 PM
Windows 10 64-bit SQL Anywhere 17 17.0.4.2053 I have a view that contains a sub-query in a "from" clause like this:
s1_name_and_address location_naa, s1_release, (SELECT CASE WHEN cntmf.misc_field_nbr = 1 THEN cntmf.miscellaneous_field ELSE NULL END AS misc_column_description1 FROM s1_miscellaneous_field_data cntmf WHERE cntmf.program_code IN ('PCE','SCE','OCE') AND cntmf.table_key = 's1_contract' ),
when I execute this SQL I get this error:
Could not execute statement. Syntax error near ',' on line 244 SQLCODE=-131, ODBC 3 State="42000" Line 244
Line 244 points to the end of the sub-query. When I execute the sub-query in a stand alone manner it behaves as expected. Is this a limitation or an error or ?? Thanks
In a view definition, each column in the SELECT list must have a defined name. For a subselect you need to add an alias after the closing bracket. For a regular SELECT there is no need to give an alias here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
66 | |
11 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.