我正在尝试将一个哈希值与每个键的另一个哈希值进行比较。像下面一样
db_data = [{"user_id"=>"000879", "dept"=>"1066", "type"=>"A", "rate"=>"999"},
{"user_id"=>"000879", "dept"=>"1066","type"=>"AB", "rate"=>"999"},
{"user_id"=>"008118", "dept"=>"10000869", "type"=>"A", "rate"=>"950"}]
file_data = [{"user"=>"00094967", "dept_id"=>"0020", "price"=>950, "div_type"=>"A"},
{"user"=>"00094967", "dept_id"=>"0020", "price"=>950, "div_type"=>"A"},
{"user"=>"00094967", "dept_id"=>"0020", "price"=>950, "div_type"=>"AB"}]
我需要比较第一个哈希数据中的特定值键,以与每个哈希值的第二个特定键值进行比较。就像从dept_id
file_data 与 db_data 比较所有键值dept
,如果没有得到则存储在变量中(不同的数据存储)