I have two tables:
Table_A
name1
create_date
Table_B
name2
keep_time
name1 is something like xxxxxx-yyy and name2 is like xxxxxxx. name2 is exactly the first part of the name1 separated by ‘-‘.
I would like to get all the rows in Table_A, whose keep_time is less than (now – create_date).
As you understand, the problem is how I can split the name1 by ‘-‘ character and get the first part and get the keep_time from Table_B by corresponding name2.
I need to write SQL in MySQL for such query?
Thanks
If I’ve understood your requirements correctly:
EDIT : DateDiff.