I would like to join 2 arrays in ruby like in sql but I don't know how.
For example,
array1=[[50,'2020-01-05'],[23,'2020-02-06']] array2=[['2020-01-05',1],['2020-02-06',3]] would be joined like
joinResult=[[50,'2020-01-05',1],[23,'2020-02-06',3]] In SQL terms I would do the following:
SELECT * FROM A, B WHERE A.DATE=B.DATE; Edit: The arrays are derived by the following commands:
array1=MySQLView1.all().to_a array2=MySQLView2.all().to_a Namely, the arrays are mysql views that I want to join.
Any ideas?
https://stackoverflow.com/questions/65956224/ruby-join-2-arrays-like-in-sql January 29, 2021 at 10:20PM
没有评论:
发表评论