Mysql 我需要选择此条件的位置
我在MySQL中有两个表 1.表格-答案具有属性和值Mysql 我需要选择此条件的位置,mysql,sql,codeigniter,Mysql,Sql,Codeigniter,我在MySQL中有两个表 1.表格-答案具有属性和值 Id_Answer Id_Form Result Total Average ------------------------------------------------------------------------------- 13 1 ["2","3","1","3","1","1","2","3"]
Id_Answer Id_Form Result Total Average
-------------------------------------------------------------------------------
13 1 ["2","3","1","3","1","1","2","3"] 16 2.00
15 1 ["2","2","1","3","0","2","1","0"] 11 1.38
Id_Criterion . Id_Form . Topic Min . Max . Detail
-------------------------------------------------------------------------------------------
1 1 Good person 1.5 2 You is a Good person
2 1 Bad person 0 1.4 You is a bad
2.表-标准具有属性和值
Id_Answer Id_Form Result Total Average
-------------------------------------------------------------------------------
13 1 ["2","3","1","3","1","1","2","3"] 16 2.00
15 1 ["2","2","1","3","0","2","1","0"] 11 1.38
Id_Criterion . Id_Form . Topic Min . Max . Detail
-------------------------------------------------------------------------------------------
1 1 Good person 1.5 2 You is a Good person
2 1 Bad person 0 1.4 You is a bad
我需要获取criteion.Topic,criteion.Mix,criteion.Min,criteion.Max,criteion.Detail到,我将使用Answer.Average在criteria.Min和criteria.Max和Answer.Id\u Form=criteria.Id\u Form中进行比较 如何为此创建查询?查询
select b.Topic, b.Min, b.Max, b.Detail
from Answer a
inner join Criterion b
on a.Id_Form = b.Id_Form and a.Average between b.Min and b.Max
询问
将其应用于CodeIgniter alsoHi。再见。看见