NotesSQL Query error

While executing the following query from a VB application through the NotesSQL ODBC driver, I get a “Lotus code gen. error”:

(SELECT ID_Listino, Famiglia, Classe, Tipo, Prodotto, Des_Prodotto, Attività, Prezzo_Formattato, UM, FCTP, Produttore, Distributore

FROM LISTINI_OFF_STD

WHERE FCTP NOT in (SELECT FCTP FROM LISTINI_OFF_CLI WHERE CODCLIENTE = ‘LEADER-0000003’))

UNION

(SELECT ID_Listino, Famiglia, Classe, Tipo, Prodotto, Des_Prodotto, Attività, Prezzo_Formattato, UM, FCTP, Produttore, Distributore

FROM LISTINI_OFF_CLI

WHERE CODCLIENTE=‘LEADER-0000003’)

the first part of the query (before the UNION clause) returns the correct data, the ones I expect. Also the second part of the query works. It seems like the UNION clause is the problem, but I don’t understand why: the amount of fields in the SELECT clause is the same, and also their name… the two views involved are about the same form.