本文介绍了FQL profile.pic_square 和 thread.subject的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 FQL 连接 Facebook API 中的两个表?

SQL 风格的经典方式不起作用.

希望能帮到你:)

PS:获胜:)

解决方案

As 文档

Facebook 查询语言或 FQL 使您能够使用 SQL 样式的界面来查询 Graph API 公开的数据.它提供了 Graph API 中没有的一些高级功能,包括将多个查询批处理到单个调用中.您可以通过获取 https://api.facebook.com/method/fql.query?query=QUERY 来执行 FQL 查询.您可以使用格式查询参数将响应格式指定为 XML 或 JSON.查询的形式为 SELECT [fields] FROM [table] WHERE [conditions].与 SQL 不同,FQL FROM 子句只能包含一个表.您可以在 SELECT 或 WHERE 子句中使用 IN 关键字来执行子查询,但子查询不能引用外部查询范围内的变量.您的查询还必须是可索引的,这意味着它会查询以下文档中标记为可索引的属性.FQL 可以处理简单的数学运算、基本的布尔运算符、AND 或 NOT 逻辑运算符以及 ORDER BY 和 LIMIT 子句.对于任何需要 uid 的查询,您可以通过 me() 返回登录用户.例如:SELECT name FROM user WHERE uid = me()其他可用的函数有 now()、strlen()、substr() 和 strpos().下面是一个子查询的例子,它获取活动用户和朋友的所有用户信息:SELECT uid, name, pic_square FROM user WHERE uid = me()或 uid IN (SELECT uid2 FROMfriend WHERE uid1 = me())

他们没有提到加入.所以在我看来你不能这样做.

is it possible to get a join of two tables in the Facebook API, with FQL?

The classic way with SQL style don´t work.

Hope you can help :)

PS: WINNING :)

解决方案

As Documentation Says

Facebook Query Language, or FQL, enables you to use a SQL-style interface to query the data exposed by the Graph API. It provides for some advanced features not available in the Graph API, including batching multiple queries into a single call.
You can execute FQL queries by fetching https://api.facebook.com/method/fql.query?query=QUERY. You can specify a response format as either XML or JSON with the format query parameter.
Queries are of the form SELECT [fields] FROM [table] WHERE [conditions]. Unlike SQL, the FQL FROM clause can contain only a single table. You can use the IN keyword in SELECT or WHERE clauses to do subqueries, but the subqueries cannot reference variables in the outer query's scope. Your query must also be indexable, meaning that it queries properties that are marked as indexable in the documentation below.
FQL can handle simple math, basic boolean operators, AND or NOT logical operators, and ORDER BY and LIMIT clauses.
For any query that takes a uid, you can pass me() to return the logged-in user. For example:
SELECT name FROM user WHERE uid = me() 
Other functions that are available are now(), strlen(), substr() and strpos().
Here's an example of a subquery that fetches all user information for the active user and friends:
SELECT uid, name, pic_square FROM user WHERE uid = me()
OR uid IN (SELECT uid2 FROM friend WHERE uid1 = me())

They have not mentioned join. So in my opinion you cannot do this.

这篇关于FQL profile.pic_square 和 thread.subject的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 03:12