我有 2 个模型 Scale 和 Step,其中模型 Scale 有很多 Step。数据库表是:
scale : id | name | s1 | s2 | s3 | s4 | s5 | s6 | s7
step : id | val
我想在 cakephp 结构中编写以下查询...
select s.id, s1.val as v1, s2.val as v2, s3.val as v3, s4.val as v4, s5.val as v5, s6.val as v6, s7.val as v7
from scale s
join step s1 on s.s1 = s1.id
join step s2 on s.s2 = s2.id
join step s3 on s.s3 = s3.id
join step s4 on s.s4 = s4.id
join step s5 on s.s5 = s5.id
join step s6 on s.s6 = s6.id
join step s7 on s.s7 = s7.id
你能帮我语法吗?