1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Error in table update from select

Discussion in 'MySQL' started by piropeator, May 20, 2016.

  1. #1
    I want to run this code, but I get this message:" #1052 - Column 'name' in field list is ambiguous"
    UPDATE SC_CTACTE_TEMP s,
        (SELECT codigo, name, COUNT(1) cantidad
        FROM sc_temp_cuotas
        GROUP BY codigo
        HAVING COUNT( codigo ) > 0
        ORDER BY codigo ASC) t1
    SET cod_stud = t1.codigo,
        fec_mov_cta = "2016-04-30",
        periodo = "201604",
        cant_ejemplares = t1.cantidad,
        name = t1.name
    WHERE s.cod_stud = t1.codigo
    
    PHP:
    What is wrong?
     
    Solved! View solution.
    piropeator, May 20, 2016 IP
  2. #2
    Probably that you have multiple name-columns in the different tables. Prefix the name column with the table name.
     
    PoPSiCLe, May 20, 2016 IP
  3. piropeator

    piropeator Well-Known Member

    Messages:
    194
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    121
    #3
    forget to punt "s." in every name-column.
    UPS!!
     
    piropeator, May 20, 2016 IP