Use a subquery:
UPDATE nations
SET count = (
SELECT COUNT(id)
FROM poets
WHERE poets.nation = nations.id
GROUP BY id
);
More Related Contents:
- INNER JOIN ON vs WHERE clause
- How to SELECT the newest four items per category?
- Simple way to calculate median with MySQL
- Unioning two tables with different number of columns
- NULL in MySQL (Performance & Storage)
- MySQL function to find the number of working days between two dates
- MySQL Trigger to prevent INSERT under certain conditions
- MySQL “NOT IN” query
- Emulate MySQL LIMIT clause in Microsoft SQL Server 2000
- Importance of varchar length in MySQL table
- mySQL :: insert into table, data from another table?
- Return 0 if field is null in MySQL
- MySQL “between” clause not inclusive?
- MySQL syntax for Join Update
- SQL – How to transpose?
- SQL SELECT to get the first N positive integers
- Sorting string column containing numbers in SQL?
- Multiple Ranks in one table
- The difference between ‘AND’ and ‘&&’ in SQL
- How can I make an average of dates in MySQL?
- What is the best way to generate ranks in MYSQL?
- How do I list all the columns in a table?
- Two single-column indexes vs one two-column index in MySQL?
- VARCHAR as foreign key/primary key in database good or bad?
- What’s the correct name for an “association table” (a many-to-many relationship) [closed]
- How do I create a table alias in MySQL
- sql pulling a row for next or previous row of a current row
- Row Rank in a MySQL View
- Select Rows with Maximum Column Value group by Another Column
- mysql GROUP_CONCAT duplicates