如果我有嵌套查询的查询:
SELECT name, start_time FROM event WHERE creator IN (SELECT page_id, name FROM place WHERE distance(latitude, longitude, "59.436961", "24.753575") < 100) LIMIT 1
输出:
{
"data": [
{
"name": "JOIN THE CLUB – JAMES WERTS LIVE",
"start_time": "2014-06-29T23:00:00+0300"
}
]
}
所以我有一个活动的名字,但我怎么能得到&#34; name&#34;来自&#34;地点&#34;的查询中的字段表
答案 0 :(得分:1)
在SQL中,你会这样做:
SELECT event.name, place.name FROM event, place
但FQL非常有限,可让您SELECT ... FROM event
或SELECT ... FROM place
。
因此,在您的情况下,您无法从place
表中获取地名,但您可以从host
表中获取event
字段,其中包含相同的字段信息:
SELECT name, start_time, host
FROM event
WHERE creator IN
(SELECT page_id
FROM place
WHERE distance(latitude, longitude, "59.436961", "24.753575") < 100)
LIMIT 1
结果:
{
"data": [
{
"name": "JOIN THE CLUB – JAMES WERTS LIVE",
"start_time": "2014-06-29T23:00:00+0300",
"host": "Venus Club"
}
]
}