How to make a query UPDATE calling a variable (Mysql Connector use)

What do I want to achieve?
Call a variable inside an UPDATE QUERY

I will explain you what do I have

We have a table called Despacho

We want to UPDATE a value

I have a SELECT query -> SELECT IDDESPACHO FROM Pruebas_DB.Despacho in which is stored in a variable called CHAR SELECT[];

and I want to use that variable "CHAR SELECT[]" inside of another query (UPDATE QUERY to be more specific)

which is the next one:

char UPDATE_DATA[] = "UPDATE Pruebas_DB.Despacho SET Litros_Despachados = %s WHERE IDDESPACHO = "(Variable CHAR SELECT[] that I dont know how to make a reference)";

What does update_data[] do?

Update a column value called Litros_Despachados

and then the issue is in the condition

when I want to compare in this case the IDDESPACHO with the variable CHAR SELECT[] that I mentioned
at the first paragraph
I dont know how to call it inside the update query and execute it.

#include <MySQL_Connection.h>
#include <MySQL_Cursor.h>




//DB DATA
byte mac_addr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress server_addr( 0, 0, 0, 0);  // IP of the MySQL *server* here
char user[] = "user";              // MySQL user login username
char password[] = "password";        // MySQL user login password

//DB CONNECTION
EthernetClient client;
MySQL_Connection conn((Client *)&client);

void loop(){

 MySQL_Cursor *cur_mem = new MySQL_Cursor(&conn);

    char SELECT[]="SELECT IDDESPACHO FROM Pruebas_DB.Despacho  order by cont desc limit 1";
    char selectstore[20];
    
    char INSERT_DATA[] = "UPDATE  Pruebas_DB.Despacho SET Litros_Despachados = %s WHERE IDDESPACHO = SELECT[] ";

    
    
    cur_mem->execute(query);
    delete cur_mem;
    conn.close();
    Serial.println("Update");


}

What made you think that your question has anything to do with the working of this Website and Forum? I have suggested to the Moderator to move it to the Programming section.

This sort of carelessness makes unnecessary work for the Moderators.

...R

@priscilacastro

Your topic was Moved to it's current location / section as it is more suitable.

Could you also take a few moments to Learn How To Use The Forum.
Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.