morning, I have difficult to matching fields in 2 different tables,
below the structure table in MySQL, the fields that I want to match and compare using
CakePHP 3.7 is
sign_id (in table forwards_sign), sign_id (in table rules_signs), disease_id, solution_id (in table rules)
forwards_signs table
+--------+--------------+-------------+
+ ID + forward_id + sign_id +
+--------+--------------+-------------+
+ 1 + 1 + 2 +
+ 2 + 1 + 3 +
+ 3 + 1 + 5 +
+--------+--------------+--------------
rules_signs table
+-------+-----------+---------------+
+ ID + rule_id + sign_id +
+-------+-----------+---------------+
+ 1 + 5 + 2 +
+ 2 + 5 + 3 +
+ 3 + 5 + 5 +
+-------+-----------+---------------+
rules table
+-------+----------+---------+------------+-------------+---------------+-----------------------+------------+
+ ID + user_no + Nama + rules_no + disease_id + solution_id + Dibuat + Diubah +
+-------+----------+---------+------------+-------------+---------------+-----------------------+------------+
+ 5 + 1 + Budi + RUL004 + 3 + 2 + 13:08:2019 11:39:54 + null +
+-------+----------+---------+------------+-------------+---------------+-----------------------+------------+
the output that’s I want expects the result is
table results
+-------+-----------------+-----------------------+----------------+
+ ID + disease_ID + compare_sign_match + solution_id +
+-------+-----------------+-----------------------+----------------+
+ 1 + 3 + 100% + 2 +
+-------+-----------------+-----------------------+----------------+
how way to build the relation, are hasOne, hasMany or belongsToMany, and how using QueryBuilder to generate the results table above
thankyou for anyone to help me,…thanx…