Update Syntax Error

0

Good morning, I'm trying to make an "Update" to two tables in my database but doing so marks me an error and I'm not able to find the error, as far as I understand the syntax of my query is fine. But even so phpmyadmin throws me the error that something is not right with the syntax.

Here the Code:

UPDATE
    pm_t_bb
INNER JOIN pm_t_pt ON(pm_t_bb.OT = pm_t_pt.OT)
SET
    pm_t_bb.BB_1 = 'R' pm_t_bb.BB_2 = 'R' pm_t_bb.BB_3 = 'R' pm_t_bb.BB_4 = 'R' pm_t_bb.BB = '100' pm_t_bb.F_Up = Now() pm_t_pt.BB = '1.5'
WHERE
    pm_t_bb.OT = '1010176'

The one difference compared to when my updates worked was that they were in separate queries and for performance reasons, because they were uni.

Thanks in advance!

Greetings to all!

    
asked by choncua 09.10.2017 в 21:09
source

3 answers

0

Try as follows:

UPDATE
     A
SET
    pm_t_bb.BB_1 = 'R',
    pm_t_bb.BB_2 = 'R', 
    pm_t_bb.BB_3 = 'R', 
    pm_t_bb.BB_4 = 'R', 
    pm_t_bb.BB = '100', 
    pm_t_bb.F_Up = Now() ,
    pm_t_pt.BB = '1.5'

FROM pm_t_bb A
    INNER JOIN pm_t_pt B ON A.OT = B.OT

WHERE
    A.OT = '1010176'
    
answered by 09.10.2017 / 21:16
source
0

Try putting commas between the values:

UPDATE
pm_t_bb
INNER JOIN pm_t_pt ON(pm_t_bb.OT = pm_t_pt.OT)
SET
    pm_t_bb.BB_1 = 'R', pm_t_bb.BB_2 = 'R', pm_t_bb.BB_3 = 'R', 
    pm_t_bb.BB_4 = 'R', pm_t_bb.BB = '100', pm_t_bb.F_Up = Now(), pm_t_pt.BB = '1.5'
WHERE
    pm_t_bb.OT = '1010176'
    
answered by 09.10.2017 в 21:29
0

I leave the syntax of the MySQL page for the UPDATE.

UPDATE tabla SET campo = valornuevo WHERE condición;

MySQL UPDATE Syntax

    
answered by 09.10.2017 в 22:06