cancel
Showing results for 
Search instead for 
Did you mean: 

Update & Join

Former Member
0 Kudos
7,365

Hello,

I keep receiving the error "SQL Command Not Properly Ended".

I think it has something with my attempt to do with the join.

UPDATE FGMULTI

SET NON_CONFORM_ALLOCATABLE = 'Y'

FROM fgmulti as fg LEFT OUTER JOIN arinvt as ar ON fg.arinvt_id = ar.id

WHERE IN_Date = CurrentDate AND ar.Class LIKE 'CP%' OR ar.Class LIKE 'FG%' OR ar.Class LIKE 'IN%' OR ar.Class LIKE 'LA%' OR ar.Class LIKE 'PK%'

Accepted Solutions (0)

Answers (1)

Answers (1)

Breck_Carter
Participant
0 Kudos

That query is valid in SQL Anywhere... perhaps you should switch.

For more reasons to switch from MySQL to SQL Anywhere, see the Unpublished MySQL FAQ.

VolkerBarth
Contributor
0 Kudos

That query is valid in SQL Anywhere.

Are you sure?

I'm not that sure because of the different use of correlation names in the UPDATE clause and the FROM clause for table FGMULTI (i.e. without an alias in the former, with an alias in the latter) - cf. the docs:

If the FROM clause is present, table-name must specify the sole table to be updated, and it must qualify the name in the same way as it appears in the FROM clause. If correlation names are used in the FROM clause, the identical correlation name must be specified as table-name.

That being said, of course SQL Anywhere is way more flexible than some other DBMSs in that respect (updates on joins), for example MS SQL Server does not allow an alias in the UPDATE clause, AFAIK...

Breck_Carter
Participant
0 Kudos

I will amend that to read "That query is syntactically valid in SQL Anywhere" since it throws a semantic error "table not found"... and yes, I did test it, to prove that it did not throw the syntactic error "SQL Command Not Properly Ended".