0
如何將主報表字段傳遞給子報表查詢。 主要報告查詢:如何將主報表字段傳遞給子報表查詢
select pd.ID_DIMENSION as IDDIM,
pd.NOMBRE as pdnombre,
pdi.VALOR_PONDERACION_GOB as pdipond,
pdi.VALOR_PONDERADO as pdiponderado
from pgs_indice pi
join pgh_indice_vigencia piv on piv.ID_INDICE = pi.ID_INDICE
JOIN pgh_dimension_indice pdi ON piv.ID_INDICE_VIGENCIA = pdi.ID_INDICE_VIGENCIA
JOIN pgb_dimension pd ON pd.ID_DIMENSION = pdi.ID_DIMENSION
where pi.ID_INDICE = $P{INDICE} AND piv.VIGENCIA = $P{VIGENCIA}
子報表查詢:
SELECT DISTINCT pc.NOMBRE as pcnombre,
pcd.VALOR_PONDERACION_GOB as pcdpond,
pcd.VALOR_PONDERACION as pcdponderacion,
FORMAT(((pcd.VALOR_PONDERACION_GOB * 100)/(pcd.VALOR_PONDERACION_GOB + pcd.VALOR_PONDERACION)),2) as pcdpondgobcal,
FORMAT(((pcd.VALOR_PONDERACION * 100)/(pcd.VALOR_PONDERACION_GOB + pcd.VALOR_PONDERACION)),2) as pcdpondcal
FROM pgs_indice indi
JOIN pgh_indice_vigencia piv ON piv.ID_INDICE = indi.ID_INDICE
JOIN pgh_dimension_indice pdi ON piv.ID_INDICE_VIGENCIA = pdi.ID_INDICE_VIGENCIA
JOIN pgb_dimension pd ON pd.ID_DIMENSION =pdi.ID_DIMENSION
JOIN pgh_categoria_dimension pcd ON pcd.ID_DIMENSION_INDICE = pdi.ID_DIMENSION_INDICE
JOIN pgb_categoria pc ON pc.ID_CATEGORIA = pcd.ID_CATEGORIA
JOIN pgh_indicador_categoria pic ON pic.ID_CATEGORIA_DIMENSION = pcd.ID_CATEGORIA_DIMENSION
JOIN pgb_indicador pi ON pi.ID_INDICADOR = pic.ID_INDICADOR
WHERE indi.ID_INDICE = $P{INDICE}
AND piv.VIGENCIA = $P{VIGENCIA}
AND pd.ID_DIMENSION =1 Here
我想用主報表字段( 'pd.ID_DIMENSION爲IDDIM')在報表查詢在條件:
(WHERE indi.ID_INDICE = $P{INDICE} AND piv.VIGENCIA = $P{VIGENCIA} AND pd.ID_DIMENSION = Here I want use)
謝謝你這麼多gDeGreat .. 它的工作。 –
我還有其他問題。 你在嗎? –
是的,我還在這裏 – ggDeGreat