fql 加入;我可以使用 FQL 连接两个表吗?

发布于 2024-11-18 00:57:35 字数 1212 浏览 4 评论 0 原文

我有以下 FQL 我想加入用户表以添加名称字段!我该怎么做?在我测试正常左连接后,我收到错误消息(601 join not possible with FQL)。我如何加入并添加名称字段???

<!DOCTYPE html>
<html>
<body>
<div id="fb-root"></div>
<a href="#" onclick="getPhotos();return false;">Get Photos</a>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
  FB.init({ appId: 'yourAppID', status: true, cookie: true, xfbml : true });

  function getPhotos() {  
    FB.login(function(response) {
      if (response.session && response.perms) {
        var oneWeekAgo = Math.round((new Date().setDate(new Date().getDate()-7)) / 1000);
        FB.api(
          {
            method: 'fql.query',
            query: 'SELECT pid, caption, aid, owner, link, src_big, src_small, created, modified FROM photo WHERE aid IN (SELECT aid FROM album WHERE owner IN (SELECT uid2 FROM friend WHERE uid1=me())) AND created > ' + oneWeekAgo + ' ORDER BY created DESC LIMIT 20'
          },
          function(response) {
            alert('Photos: ' + JSON.stringify(response));
          }
        );
      }
    } , {perms:'friends_photos'}); 
}
</script>
</body>
</html>

I have the following FQL I want to join with user table to add name field! How can I do that?After I test making normal left join I got error message (601 join not possible with FQL). How can I join and add name field????

<!DOCTYPE html>
<html>
<body>
<div id="fb-root"></div>
<a href="#" onclick="getPhotos();return false;">Get Photos</a>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
  FB.init({ appId: 'yourAppID', status: true, cookie: true, xfbml : true });

  function getPhotos() {  
    FB.login(function(response) {
      if (response.session && response.perms) {
        var oneWeekAgo = Math.round((new Date().setDate(new Date().getDate()-7)) / 1000);
        FB.api(
          {
            method: 'fql.query',
            query: 'SELECT pid, caption, aid, owner, link, src_big, src_small, created, modified FROM photo WHERE aid IN (SELECT aid FROM album WHERE owner IN (SELECT uid2 FROM friend WHERE uid1=me())) AND created > ' + oneWeekAgo + ' ORDER BY created DESC LIMIT 20'
          },
          function(response) {
            alert('Photos: ' + JSON.stringify(response));
          }
        );
      }
    } , {perms:'friends_photos'}); 
}
</script>
</body>
</html>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

弄潮 2024-11-25 00:57:35

做这样的事情:

FB.api({
    method: 'fql.multiquery',
    queries: {
        'query1': 'SELECT uid2 FROM friend WHERE uid1 = me()',
        'query2': 'SELECT vid, owner, title, description FROM video WHERE owner IN (SELECT uid2 FROM #query1)'
    }
},
function(response) {
    // response should have 2 objects in it, both containing an fql_result_set 
    // array with the data and the name you entered for the query (i.e. 'query1')
    alert('Photos: ' + JSON.stringify(response));
});

Do something like this:

FB.api({
    method: 'fql.multiquery',
    queries: {
        'query1': 'SELECT uid2 FROM friend WHERE uid1 = me()',
        'query2': 'SELECT vid, owner, title, description FROM video WHERE owner IN (SELECT uid2 FROM #query1)'
    }
},
function(response) {
    // response should have 2 objects in it, both containing an fql_result_set 
    // array with the data and the name you entered for the query (i.e. 'query1')
    alert('Photos: ' + JSON.stringify(response));
});
往日情怀 2024-11-25 00:57:35

你需要运行一个嵌套查询,就像

https://api.facebook.com/method/fql.query?query=SELECT uid,pic_square, first_name, last_name from user where uid IN (SELECT uid FROM page_fan WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())AND page_id = PAGE_ID)&access_token=YOUR_ACCESS_TOKEN

我需要我朋友的名字,来自喜欢该页面的页面的图片。所以运行一个嵌套查询,它对我有用

检查此链接https://developers.facebook.com/docs/reference/fql/

Facebook 已经公开了他们的数据库。希望对您有帮助

you need to run a nested query like

https://api.facebook.com/method/fql.query?query=SELECT uid,pic_square, first_name, last_name from user where uid IN (SELECT uid FROM page_fan WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())AND page_id = PAGE_ID)&access_token=YOUR_ACCESS_TOKEN

i need the my friend name, pic from a page whoever liked that page.so run a nested query and it worked form me

Check this link https://developers.facebook.com/docs/reference/fql/

Facebook have exposed their database. Hope it helps you

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文