Hi,
(I have a feeling that this will be depressingly simple - but I just can't see it right now.) The following code is failing with: Error: near line 3: no such column: dtls.mapname2 explain with dtls as (select distinct wrk.mapname as mapname2 ,udb.udb_key ,rel.tablename ,rel.queryid from waPSM_TABLE_MAPNAME_WRK as wrk inner join relation as rel on wrk.queryid = 1 and wrk.queryid = rel.queryid and wrk.tablename = rel.name inner join User_Database as udb on wrk.databasename = udb.udb_name and rel.udb_key = udb.udb_key) update relation set wamapname = dtls.mapname2 where queryid = dtls.queryid and udb_key = dtls.udb_key and tablename = dtls.tablename; I'm running it using the windows 32-bit shell program v3.20.1 If I just run the CTE component by itself it runs fine. What am I missing? All help greatly appreciated, Dave _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users