简体   繁体   English

如何在Facebook FQL上进行内部联接

[英]How to do an inner join on Facebook FQL

Ok, so I'm querying two FQL tables: Events and event_members. 好的,所以我要查询两个FQL表:Event和event_members。 On one query I get all events from the user and his friends (let's call this $events), and on the other query I get all the members 'attending' to all those events (let's call it $attendingmembers). 在一个查询中,我从用户和他的朋友那里获得了所有事件(我们将其称为$ events),在另一个查询中,我将所有成员“参与”到所有这些事件中(将其称为$ attendingmembers)。 Both queries are returned as arrays on php, and as you may already know FQL doesn't allow INNER JOINS. 这两个查询都作为数组在php上返回,并且您可能已经知道FQL不允许使用INNER JOINS。

What I want to do is to "normalize" the data, so that I join both results and I get a single array with all the event details AND the amount of people attending to that event. 我要做的是“标准化”数据,以便同时加入两个结果,并得到一个包含所有事件详细信息和参加该事件的人数的数组。 Both arrays share a common KEY: eid. 两个数组共享一个公共的KEY:eid。

On sql it would be very easy... Inner JOIN. 在sql上将非常容易...内部联接。 BUT on FQL there is no Inner join, so I think I should do the join 'php-side', with array_intersect o something similar, but i can't get to find the way to do it. 但是在FQL上没有内部联接,所以我认为我应该使用array_intersect或类似的方法进行“ php端”联接,但是我找不到方法。

Help is really appreciated! 非常感谢您的帮助!

An inner join would not give you the number of people attending. 内部加入不会给您参加会议的人数。 A count would. 计数会。 Also, that is not "normalizing" the data, it's confusing to think of it as such. 同样,这并不是在“标准化”数据,将其视为一种混淆。

To do this in a programming language (such as PHP), just iterate through the array and increment a counter each time the element is found. 要使用编程语言(例如PHP)进行此操作,只需遍历数组并在每次找到元素时增加一个计数器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM