I am trying to solve a complex problem. I have a query structured as follows:
Select
(
SELECT a.CD_MAD, b.* FROM
(
SELECT '0' & [CD_SOC] & [CT_OPR] & [CD_MVT] & [CT_MVT] & [CD_RGL_FIN] & [CD_MODEPAIE] AS p,
[table3].CD_MAD FROM table3
) AS a
RIGHT JOIN (
SELECT trim([CODECIE]) & trim([TPOPER]) & trim([MVNT]) & trim([TPMVNT]) & trim([MODEPAIE]) & trim([MODEPAIE1]) AS p,
tbl1.CODEENR, tbl1.CODECIE, tbl1.TPOPER, tbl1.MVNT,
tbl1.TPMVNT, tbl1.DTCOMPT, tbl1.DTDEBEF, tbl1.SIGNE,
tbl1.TTTCF, tbl1.TTTCG, tbl1.DEVISEF, tbl1.DEVISEG,
tbl1.CODEPDT, tbl1.NOCTR, tbl1.NOPIECE, tbl1.CATMIN,
tbl1.NOCPT, tbl1.MODEPAIE, tbl1.THTF, tbl1.THTG,
tbl1.TAXE_F, tbl1.TAXE_G, tbl1.FRAC, tbl1.APPORT,
tbl1.VENDEUR, tbl1.MODEPAIE1, tbl1.TPEVNT,
tbl1.FAITGEN, tbl1.DTSURV, tbl1.DURPR, tbl1.NOPIECE1,
tbl1.ANNEE, tbl1.MNTCOMCO, tbl1.MNTCOMAP, tbl1.ID
FROM tbl1
) AS b ON b.p=a.p
);
this query basically creates a join between two subsets of two existing tables without going through the creation of temporary tables (this is my goal!); This request is working fine. but now I would like to insert the results of the query into a table; I've already tried the paste-in statement, but it seems to fail; in particular, it seems that the alias "a" and "b" that I used to create the query are not recognized when I execute the insert statement in.
How can I solve this problem?