Salut a tous,
J'essaye de faire marcher un UPDATE utilisant un alias. Mais j'obtiens l'erreur suivante:
Voici la requete:ERROR: column "p" of relation "tbl_proposals" does not exist
LINE 2: SET P.fld_proposal_value = HP.fld_proposal_value
^
********** Error **********
ERROR: column "p" of relation "tbl_proposals" does not exist
SQL state: 42703
Character: 31
J'utilise PostgreSQL 8.3
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 UPDATE tbl_proposals AS P SET P.fld_proposal_value = HP.fld_proposal_value FROM (SELECT fld_proposal_id, max(fld_id) AS max_id FROM tbl_proposals_history GROUP BY fld_proposal_id) AS mx, tbl_proposals_history AS HP WHERE HP.fld_id=mx.max_id AND P.fld_id=HP.fld_proposal_id AND (P.fld_proposal_value IS NULL OR P.fld_proposal_value = 0) AND (P.fld_status = 'Issued' OR P.fld_status ='On Hold' OR P.fld_status = 'Won' OR P.fld_status = 'Lost' OR P.fld_status = 'Dead') AND HP.fld_proposal_value IS NOT NULL
Partager