insert into #users(userid)
select userid
From maintableA
Inner join
(
Select id
from maintable
where user_id=@createdby
) B
on A.id=B.id
@createdby
参数包含具有以下结构的JSON数据:
{用户:{“创建者”:“ 23”}}
如何从此JSON中获取“ createdby”的值?
答案 0 :(得分:0)
您可以使用内置的JSON_VALUE函数:
23
结果:insert into #users(userid)
select userid
From maintableA
Inner join
(
Select id
from maintable
where user_id = JSON_VALUE(@createdby, '$.User.createdby')
) as B on A.id=B.id
因此,您的代码如下所示:
let historyRef = ref.child("history")
let riderRef = ref.child("Users/Riders").child(riderID).child("history")
let driverRef = ref.child("Users/Drivers").child(driverID).child("history")
let key = historyRef.childByAutoId().key
historyRef.child(key).setValue(true)
riderRef.child(key).setValue(true)
driverRef.child(key).setValue(true)