Query = Unknown system variable 'c3'

StoneStreet

I'm trying to use both REPLACE and SETin a query, whithout any succes!

Error message:

Unknown system variable 'c3'

What am i doing wrong?

PHP

 $query = "SET NEW.c3 = CONCAT(OLD.c3, NEW.:c3);
           REPLACE INTO table(
                c1,
                c2,
                c3)
           VALUES(
                :c1,
                :c2,
                :c3)";
$query_params = array(
                ':c1' => $c1,
                ':c2' => $c2,
                ':c3' => $c3); 
axiac

My guess is you want to insert a new row or update the existing one (if it already exists in the table). If this is the case then the correct query is:

INSERT INTO table(c1, c2, c3) VALUES
    (:c1, :c2, :c3)
ON DUPLICATE KEY UPDATE
    c3 = CONCAT(c3, :c3);

or, if you want to insert/update many rows at once:

INSERT INTO table(c1, c2, c3) VALUES
    (:c1, :c2, :c3),
    (:d1, :d2, :d3),
    (:e1, :e2, :e3)
ON DUPLICATE KEY UPDATE
    c3 = CONCAT(c3, VALUES(c3));

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

MySQL Error 1193: Unknown system variable 'discount_advanced_rules'

From Java

Initialising a variable of unknown type via overloaded constructors in C++

From Dev

How to set system environment variable in C#?

From Dev

Python 3 exception deletes variable in enclosing scope for unknown reason

From Dev

Unknown system variable using DECLARE

From Dev

How to know the Data type of a variable of unknown type in C?

From Dev

Declare variable with unknown type

From Dev

C Passing array of unknown size to a function in a single variable

From Dev

Access c variable in system command

From Dev

Parametrized query unknown total params

From Dev

Query MSMQ System Queues in C#

From Dev

Error Creating Trigger Unknown System Variable

From Dev

PDO Select query with unknown columns?

From Dev

How to control where id is equal to unknown number of variable sql query?

From Dev

java.sql.SQLException: Unknown system variable 'query_cache_size'

From Dev

Unknown system variable using DECLARE

From Dev

Query over unknown variable

From Dev

Unknown variable in JavaScript function

From Dev

mkdir system call with variable (C)

From Dev

Declare variable with unknown type

From Dev

C Passing array of unknown size to a function in a single variable

From Dev

C3 bar chart unknown number of bars

From Dev

unknown file system, grub rescue

From Dev

Error "Unknown system variable 'lower_case_table_names'" when accessing MySql from Eclipse

From Dev

Smokeping unknown variable 'menu'

From Dev

SQL QUERY Unknown column <unknown column name> in <unknown field list>

From Dev

Get count of values in json data and create variable based on those for c3 table

From Dev

Variable in first .append is unknown

From Dev

Alteryx Unknown Variable

Related Related

  1. 1

    MySQL Error 1193: Unknown system variable 'discount_advanced_rules'

  2. 2

    Initialising a variable of unknown type via overloaded constructors in C++

  3. 3

    How to set system environment variable in C#?

  4. 4

    Python 3 exception deletes variable in enclosing scope for unknown reason

  5. 5

    Unknown system variable using DECLARE

  6. 6

    How to know the Data type of a variable of unknown type in C?

  7. 7

    Declare variable with unknown type

  8. 8

    C Passing array of unknown size to a function in a single variable

  9. 9

    Access c variable in system command

  10. 10

    Parametrized query unknown total params

  11. 11

    Query MSMQ System Queues in C#

  12. 12

    Error Creating Trigger Unknown System Variable

  13. 13

    PDO Select query with unknown columns?

  14. 14

    How to control where id is equal to unknown number of variable sql query?

  15. 15

    java.sql.SQLException: Unknown system variable 'query_cache_size'

  16. 16

    Unknown system variable using DECLARE

  17. 17

    Query over unknown variable

  18. 18

    Unknown variable in JavaScript function

  19. 19

    mkdir system call with variable (C)

  20. 20

    Declare variable with unknown type

  21. 21

    C Passing array of unknown size to a function in a single variable

  22. 22

    C3 bar chart unknown number of bars

  23. 23

    unknown file system, grub rescue

  24. 24

    Error "Unknown system variable 'lower_case_table_names'" when accessing MySql from Eclipse

  25. 25

    Smokeping unknown variable 'menu'

  26. 26

    SQL QUERY Unknown column <unknown column name> in <unknown field list>

  27. 27

    Get count of values in json data and create variable based on those for c3 table

  28. 28

    Variable in first .append is unknown

  29. 29

    Alteryx Unknown Variable

HotTag

Archive