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
value1212
(example) in it. - table2 has field named
action
dataadded 1212
orupdated 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
Post a Comment