mysql - How to match part of a field with data in another field with query? -


i have 2 tables table1 , table2:

  • table1 contains field named id value 1212 (example) in it.
  • table2 has field named action data added 1212 or updated 1212.

now check query.

select t1.*, t2.name table1 t1, table2 t2 t2.action 'added t1.id' 

i want add name field in second table, first 1 added(updated not needed) data only. clause condition? how can query this?

i did this.

select t1.*, t2.name table1 t1, table2 t2 t1.id = (right(t2.action, 4)) , t2.action 'added %' 

thanks tried me.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -