Multi-part identifier could not be bound

  • Hello. When I run this query I got

    "The multi-part identifier gf.periodo could not be bound"

    "The multi-part identifier gfdet.periodo could not be bound"

    Can anyone tell me what is wrong? Thank you.

    SELECTgf.periodo,

    gf.folio,

    gfdet.material,

    pro.factor,

    'CveProyecto Prorateo' = pro.proyecto,

    'Nombre Proyecto Prorateo' = cproy.nombre,

    'CveProyecto' = gfdet.proyecto,

    'Nombre Proyecto' = catproy.nombre

    FROM tblFinaDocugf

    INNER JOIN tblFinaDocuLinegfdet

    ON gf.folio = gfdet.folio

    LEFT JOIN tblContProycatproy

    ON gfdet.proyecto = catproy.proyecto

    LEFT JOIN (SELECT factor = gp.factor / (SELECT sum(factor) FROM usrFinaProrGastPeri temp

    WHERE temp.periodo = gf.periodo AND temp.material = gfdet.material),

    gp.material,

    gp.proyecto,

    gp.periodo

    FROM usrFinaProrGastPerigp

    WHEREgp.Periodo = gf.periodo

    ANDgp.material = gfdet.material)

    AS pro

    ON (gf.periodo = pro.periodo AND gfdet.material = pro.material)

    LEFT JOIN tblContProycproy

    ON pro.proyecto = cproy.proyecto

    WHEREgf.periodo > '200703'

    ANDgf.periodo < '200713'
    AND((gf.folio LIKE 'GF%') OR (gf.folio LIKE 'GC%') OR (gf.folio LIKE 'GA%'))
    ANDgf.aplicado = 1
    AND(gf.poliza IS NOT NULL)

  • *pro.factor isn't in the select, why do you calculate it?

    *Is

    'CveProyecto Prorateo' = pro.proyecto

    testing if pro.proyecto is equal to the literal 'CveProyecto Prorateo'?

    *

    LEFT JOIN (SELECT factor = gp.factor / (SELECT sum(factor) FROM usrFinaProrGastPeri temp

    WHERE temp.periodo = gf.periodo AND temp.material = gfdet.material),

    gp.material,

    gp.proyecto,

    gp.periodo

    FROM usrFinaProrGastPeri gp

    WHERE gp.Periodo = gf.periodo

    AND gp.material = gfdet.material)

    AS pro

    ON (gf.periodo = pro.periodo AND gfdet.material = pro.material)

    seems to be an odd construction because there is no table that passes as "gf" in the left outerjoin construction

  • I assume that gf.periodo is a datetime field, yet you are only supplying a year / month construct. Could this be a part of the issue?

    Jo - gf is defined in the first from clause (about 10 lines in).

  • Thank you Jo, Richard.

    Jo pro.factor is in the outer select list and it is being calculated in the derived table pro.

    You asked: Is 'CveProyecto Prorateo' = pro.proyecto

    testing if pro.proyecto is equal to the literal 'CveProyecto Prorateo'?

    Answer: No, actually this is the same as saying pro.proyecto as 'CveProyecto Prorateo'

    Richard, gf.periodo is a char.

    Thank you.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply