0
Q:

update having mysql

UPDATE table_name
SET column1=value, column2=value2,...
WHERE some_column=some_value
13

 UPDATE table_name

 SET column1 = value1, column2 = value2, ...

 WHERE condition; 
4

UPDATE table_name

SET column1=value, column2=value2,...

WHERE some_column=some_value 
1
UPDATE table_name SET field1 = 'value 1', field2 = 'value 2'
WHERE field3 = 'value 3'
1
The UPDATE statement updates data in a table. It allows you to change the values in one or more columns of a single row or multiple rows.

The following illustrates the basic syntax of the UPDATE statement:

UPDATE [LOW_PRIORITY] [IGNORE] table_name 
SET 
    column_name1 = expr1,
    column_name2 = expr2,
    ...
[WHERE
    condition];
In this syntax:

First, specify the name of the table that you want to update data after the UPDATE keyword.
Second, specify which column you want to update and the new value in the SET clause. To update values in multiple columns, you use a list of comma-separated assignments by supplying a value in each column’s assignment in the form of a literal value, an expression, or a subquery.
Third, specify which rows to be updated using a condition in the WHERE clause. The WHERE clause is optional. If you omit it, the UPDATE statement will modify all rows in the table.
1
UPDATE contacts_domains cd, 
 (SELECT id FROM contacts_domains GROUP BY domain_id
   HAVING COUNT(contact_id) = 1) AS cdtmp
SET cd.dominant = 1
WHERE cd.id = cdtmp.id
0

New to Communities?

Join the community