问题描述
我能想到的一种方法是:
{
type: 'select',table: 'table1',innerjoin: {
table2: {
on: [userid','userId'] //table1Key,table2Key
}
}
}
但是问题是,如果N号之间存在联接,该怎么办?桌子?如果联接基于多个列怎么办?
例如:
SELECT x1,x2....,FROM table1 t1
INNER JOIN table2 t2 on t1.Id=t2.Id
INNER JOIN table3 t3 on t1.id=t3.Id
LEFT JOIN table4 t4 on t3.Id=t4.Id and t3.name=t4.name
解决方法
我会采用如下数组方法:
{
type: 'select',table: 'table1',joins: [{
type : 'inner'
from :'table1'
to :'table2'
on : { 'userId':'userId' // property belongs to from value belongs to to table
'secondColumn':'secondOne'
}
}
}