简体   繁体   中英

MySQL search by criteria on Hashtable

I have a hashtable in the form of:

key | value | updated_date

What I'm trying to query is something like:

if the updated_date of a key_a is greater than the updated_date of key_b, then select the data relevant to both of them

Essentially if one part of the application has been updated I need to alert the other parts of this update.

I'm guessing it requires a multiple select in the one query but not sure how to go about it and because they both have the same column names, each has to be selected using the "AS" syntax.

Any help much appreciated.

For anyone who ends up with a similar question, the answer turned out to be:

SELECT * FROM `log_action` WHERE `module_identifier` = 'module_1' AND `action_identifier` = 'action_1'
AND `date_created` > (SELECT `date_created` FROM `log_action` WHERE `module_identifier` = 'module_1' AND `action_identifier` = 'action_2' ORDER BY `date_created` DESC) 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM