I’m trying to perform a complex issue,
I have a query structured like this:
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 passing trough the building of temporary tables(which is my aim!); that query works just fine.
but now I’d like to insert the query’s results into a table;
i’d already tried the “insert into” statement but it seems to fail; in particular it seems that the alias “a” and “b” that i’v used to create the query aren’t recognized when performing the insert into statement.
How can I solve this issue?
Basically gettin rid of the first bracket and select should help