Do zložitého query som doplnil tri polia "0 AS POLE1". Zahlásil mi, že očakáva
5(?) parametrov. Túto chybovú hlášku som nikdy nepochopil.
Zistil som, že jedno pole môžem dať zo subquery. Do toho sub query som presunul zvyšné dve polia "0 AS xx". Teraz mu chýbajú 2 parametre. Presunutie týchto polí do ďalšieho subquery situáciu zhoršuje. Prečo? Čo to znamená? S Access-om už nerobím.
Ako to mám opraviť?
.
Ak som ich dal ako parametre, tak mu odrazu chýba
8 parametrov
. Prikladám aj celý SQL text.
.
SELECT D.FSID, D.FISENAME, D.L, D.H, D.PVALL AS PV, D.K10ALL AS K10, D.K11ALL AS K11, D.PREMISID, D.PREMNAM, D.PARTID,
D.PARTNAME, D.WALLFK, D.WALLNUMBER, D.WALLOPENFK, D.ISNEW, D.CUFK, D.KOPFK, D.SP, SUM(D.SPO1I) AS SPO1,
SUM(D.SPO2I) AS SPO2, SUM(D.SPO3I) AS SPO3, D.CLOSEDSTORE, D.PHTT, D.IP, D.STOREHEIGHT,
D.SPO, D.PO, D.D, //
Pôvodne som to dal len tu. Očakával 5 parametrov
D.STORED
FROM
(SELECT VD.FSID, FS.FISENAME, VD.L, VD.H,
IIF(ADC.PV IS NULL,
IIF(INC.TE IS NULL,
IIF(AGC.TE IS NULL, STC.PV,IIF(AGC.PM = 0, AGC.TE, AGC.PM)), IIF(INC.PM = 0,INC.TE, INC.PM)),
IIF(ADC.PM = 0, ADC.PV, ADC.PM)) AS PVALL,
IIF(ADC.K10 IS NULL,
IIF(INC.K10 IS NULL, IIF(AGC.K10 IS NULL, STC.K10, AGC.K10), INC.K10), ADC.K10) AS K10ALL,
IIF(ADC.K11 IS NULL, IIF(INC.K11 IS NULL, IIF(AGC.K11 IS NULL, STC.K11, AGC.K11), INC.K11), ADC.K11) AS K11ALL,
PR.PREMISID, PR.PREMNAME AS PREMNAM, PA.PARTID, PA.PARTNAME, VD.WALLFK, VD.WALLNUMBER, VD.WALLOPENFK, PA.ISNEW,
FS.CONSTRUCTIONALUNITFK AS CUFK, FS.CLOSEDSTORE, FS.KINDOFPREMFK AS KOPFK, VD.SP, STC.PHTT, STC.IP, STC.STOREHEIGHT,
STC.STORED,
IIF(NOT VD.ROOF AND NOT VD.PARTLYOPEN, PO, 0) AS SPO1I,
IIF(VD.PARTLYOPEN, PO, 0) AS SPO2I,
IIF(VD.ROOF, PO, 0) AS SPO3I,
PO,
0 AS SPO, 0 AS D //
Tu sú kritické polia. Očakáva 2 parametre
FROM PREMISES AS PR
INNER JOIN (PARTS AS PA
INNER JOIN (
(SELECT FS.FIRESECTIONID AS FSID,
IIF(SUM(V.VENTAREA * WV.VENTNUMBER) IS NULL, 0, SUM(V.VENTAREA * WV.VENTNUMBER)) AS PO, //
presunutie tu to zhoršuje. 8 parametrov
W.L * W.H AS SP, W.WALLNUMBER, W.WALLOPENFK, W.L, W.H, W.WALLID AS WALLFK, V.ROOF, V.PARTLYOPEN
FROM (FIRESECTIONS AS FS
RIGHT JOIN WALLS AS W ON FS.FIRESECTIONID = W.FIRESECTIONFK)
LEFT JOIN (VENTS AS V
RIGHT JOIN WALLVENT AS WV ON V.VENTID = WV.VENTFK)
ON W.WALLID = WV.WALLFK
GROUP BY FS.FIRESECTIONID, W.L, W.H, W.WALLNUMBER, W.WALLOPENFK, W.L, W.H, W.WALLID, V.ROOF, V.PARTLYOPEN) AS VD
INNER JOIN (AGCALC AS AGC
RIGHT JOIN
(STCALC AS STC
RIGHT JOIN (ADCALC AS ADC
RIGHT JOIN (INCALC AS INC
RIGHT JOIN FIRESECTIONS AS FS ON INC.FSID = FS.FIRESECTIONID)
ON ADC.FSID = FS.FIRESECTIONID)
ON STC.FSID = FS.FIRESECTIONID)
ON AGC.FSID = FS.FIRESECTIONID)
ON VD.FSID = FS.FIRESECTIONID)
ON PA.PARTID = FS.PARTSFK)
ON PR.PREMISID = PA.PREMISFK
WHERE FS.KINDOFPREMFK = :KINDOFPREM) AS D
GROUP BY D.FSID, D.FISENAME, D.L, D.H, D.PVALL, D.K10ALL, D.K11ALL, D.PREMISID, D.PREMNAM, D.PARTID, D.PARTNAME,
D.WALLFK, D.WALLNUMBER, D.WALLOPENFK, D.ISNEW, D.CUFK, D.KOPFK, D.SP, D.CLOSEDSTORE, D.PHTT, D.IP, D.STOREHEIGHT, SPO,
D.PO, D, D.STORED ORDER BY D.FISENAME, D.PREMNAME, D.PARTNAME, D.WALLNUMBER