How to update table based on another table column?

egomnia

How to update table based on another table column?

Here is my SQL. I'm using MySQL.

UPDATE tb_notify SET alert = '0' WHERE post_id = '01' AND (HERE IS I WANT TO GET BASED ON ANOTHER TABLE)

Another table is tb_post with same parameter in each table. That's post_id.

tb_notify
have 3 column:
1. com_id
2. post_id
3. alert

tb_post
have 3 column:
1. post_id
2. uid_post <-- Here I want to based on this column
3. post

Please help. Thanks

Abhik Chakraborty

You can use join to do the update

update tb_notify tn
join tb_post tp on tp.post_id = tn.post_id
set
tn.alert = '0'
where
tn.post_id = '01'
AND tp.uid_post = {whatever you want}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Update a column in a table based on column in another table

From Java

How to update column based on another column in the same table

From Java

How to update another table based on foreign table

From Dev

How to Update Column from a Column in another table

From Dev

How to update column with another column in the same table?

From Dev

R update table column based on search string from another table

From Dev

Update column in one table based on value in another table in mysql

From Dev

R update table column based on search string from another table

From Dev

Update column in one table based on value in another table in mysql

From Dev

update column in one table based on condition in another table

From Dev

How to update the records in a table based on comparing with the id column from another table?

From Dev

Mysql - update table column from another column based on order

From Dev

Update value in a column based on another column in the same table in MYSQL

From Dev

Update value in column based on column count in another table with mysql

From Dev

How to update one table based on aggregate query form another table

From Dev

How to update a table with values from another table based on different conditions

From Dev

MySQL how to UPDATE a field in one table based on values in another table

From Dev

How to update table based on count of entries of another table

From Dev

How to update a column in one table based on values from a second table?

From Dev

How to filter an Excel table based on values in a column shard with another table?

From Dev

SQLite - Update a column based on values from another table's columns

From Dev

Update statement to set a column based the maximum row of another table

From Dev

Update statement to set a column based the maximum row of another table

From Dev

Update SQLite table based on data in another table

From Dev

Update table with another table based on cell value

From Dev

Update table based on conditions from another table

From Dev

Update table based on another table with conditions

From Dev

How to update mysql column with another value from another table?

From Dev

How to update mysql column with another value from another table?

Related Related

  1. 1

    Update a column in a table based on column in another table

  2. 2

    How to update column based on another column in the same table

  3. 3

    How to update another table based on foreign table

  4. 4

    How to Update Column from a Column in another table

  5. 5

    How to update column with another column in the same table?

  6. 6

    R update table column based on search string from another table

  7. 7

    Update column in one table based on value in another table in mysql

  8. 8

    R update table column based on search string from another table

  9. 9

    Update column in one table based on value in another table in mysql

  10. 10

    update column in one table based on condition in another table

  11. 11

    How to update the records in a table based on comparing with the id column from another table?

  12. 12

    Mysql - update table column from another column based on order

  13. 13

    Update value in a column based on another column in the same table in MYSQL

  14. 14

    Update value in column based on column count in another table with mysql

  15. 15

    How to update one table based on aggregate query form another table

  16. 16

    How to update a table with values from another table based on different conditions

  17. 17

    MySQL how to UPDATE a field in one table based on values in another table

  18. 18

    How to update table based on count of entries of another table

  19. 19

    How to update a column in one table based on values from a second table?

  20. 20

    How to filter an Excel table based on values in a column shard with another table?

  21. 21

    SQLite - Update a column based on values from another table's columns

  22. 22

    Update statement to set a column based the maximum row of another table

  23. 23

    Update statement to set a column based the maximum row of another table

  24. 24

    Update SQLite table based on data in another table

  25. 25

    Update table with another table based on cell value

  26. 26

    Update table based on conditions from another table

  27. 27

    Update table based on another table with conditions

  28. 28

    How to update mysql column with another value from another table?

  29. 29

    How to update mysql column with another value from another table?

HotTag

Archive