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

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -