Talk:FQL
From Facebook Developer Wiki
SELECT name
FROM group
WHERE gid IN ( SELECT gid
FROM group_member
WHERE uid=u03829
AND
gid IN (SELECT gid
FROM group_member
WHERE uid=u03829))
[edit] Extending the wiki FQL section?
I'm just looking at other parts of the wiki compared to FQL. There is just about no info here. Any particular reason why? Personally I'd like to put in documentation for FQL syntax and quirks versus other query languages (esp. SQL) and of the data schema (wiki pages for each table). If there are no objections within the next day or so, I am going to go ahead and start putting this in. Dustin Fineout 09:40, 23 November 2007 (PST)
[edit] Difference in results for FQL and Method-API?
Hello,
I have been experimenting with the API Tool. I submit the following FQL query in Test Console mode:
select uid from group_member where gid="7521561140" <--- a real group with many members
In the response, I see only myself as a member of the group:
<?xml version="1.0" encoding="UTF-8"?> <fql_query_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" list="true">
<group_member> <uid>619675476</uid> <--- my own UID for the session under which I am logged in </group_member>
</fql_query_response>
But if I submit an equivalent inquiry via the groups.getMembers API call in the console Test Application mode, with the same GID, with my same login credentials, I see all group members:
<?xml version="1.0" encoding="UTF-8"?> <groups_getMembers_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">
<members list="true"> <uid>26161</uid> <--- a very long list of real UIDs <uid>206359</uid> <uid>213393</uid> <uid>512700</uid> <uid>700754</uid> <uid>709642</uid> <uid>710402</uid> <uid>710843</uid> <uid>711437</uid> <uid>711573</uid> <uid>711604</uid> <uid>713487</uid> <uid>713880</uid> <uid>714200</uid> <uid>843915</uid> <uid>930371</uid> <uid>1229612</uid> <uid>3501584</uid>
...and so forth, listing over a hundred UIDs.
I assume the Console tool uses the same login credentials for both the FQL and API modes. Why are the results not equivalent between FQL and API queries? If I am allowed to see all user members of a group via the API, why does FQL not return the same list?
- Have you asked about this in the forums? Sometimes the Wiki is ignored. 1181029451 16:10, 28 October 2008 (PDT)
[edit] Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 2: parser error : Extra content at the end of the document
I am calling a fql_query from FacebookRestClient (any other method works just fine). but it gives me the error above. if i pick it apart, i can see where the error first arises . . . drilling down to lines 375 / 376. this call "post_request" produces this error "HTML tag not supported: "title?". can anyone help?! post response below
p.s. my fql query is taken directly from examples that work, so it's not a syntactical error on my part.
Response: [post response here]
[edit] Fetching users with status
While using FQL I noticed that I cannot fetch users' with no status. I had tried status IS NOT NULL and status != "". The final solution was to use status.message != ""
select uid, name, status, profile_update_time, pic_small, pic_square, pic_big from user where uid in (select uid1 from friend where uid2 = USERID) and profile_update_time != 0 and status.message != "" order by profile_update_time desc limit 48
- Good catch, Amir. I filed bug 4195 to track this.
[edit] Text Search Using Fql?
On the official docs page for fql there is a mention "This is particularly useful in WHERE clauses, for example, WHERE "Stanford" IN education_history.name". When I have experimented with this it only brings back results for full/complete string match. For example searching albums names "FROM album WHERE owner IN (uids) AND upper("theName") IN upper(name). I have also tried using strpos(name,"theName") Can someone confirm that there is no way to search within a field for a string? If there is could you example it please. --hjb 10:00, 17 September 2007 (PDT)
- Response: you might also want to try your own hand at the wild card %. WHERE upper(name) LIKE 'theName%' . . . perhaps this would still work in fql. don't see why not.
- I can confirm that LIKE does not work in FQL. Any official reply?--hjb 12:13, 24 September 2007 (PDT)
- You can do something similar with the strpos(haystack, needle) function. For example:
- select addedtime, title from app.item where _id in (select ...) and strpos(upper(title), "GUN") >= 0
- The strpos effectively does a LIKE "%GUN%"
[edit] photo_tag table speed
I have been doing some testing and results come back from the photo_tags table REALLY slowly. A canvas page must be created in less than 12 seconds (from test also) and searches in the table can take up to 10 of this time! I tried the query:
"SELECT pid FROM photo_tag WHERE created > " . (time() - (60*60*24*2)) . " AND subject IN (" . $_POST['fb_sig_friends'] . ")";
Using php to fill in the blanks. Well I assumes that putting the "created > (2 days ago)" would make the search much faster. But no! It still took up to 10 seconds (sometimes even timing out). This is really hindering my development so could I get clarification that the table is set up correctly and whether there is anything that can be done to speed it up when using "subject IN (friends)". Thanks --hjb 14:23, 23 September 2007 (PDT)
Just to add to this. The same search on the albums table:
"SELECT aid FROM albums WHERE created > " . (time() - (60*60*24*2)) . " AND owner IN (" . $_POST['fb_sig_friends'] . ")";
takes less than half the time. Always less than 5 seconds. I know the table will be much smaller but thats madness.--hjb 14:45, 23 September 2007 (PDT)
[edit] For PHP?
Might want to post somewhere in the FQL documentation exactly how we are supposed to interface with this through PHP... I've been to about 4 pages on FQL now and I still haven't seen an example.
[edit] Headline text
[edit] Found an error ;-)
When you click the "Create Object Property" button when adding a property to an object type, the addition window's button says "Add Object Type", as if I was to add an object type. This is confusing, and should be fixed.
If this is not the right place to post this, I'm sorry - just didn't know of where to post it. Looking for guidance or confirmation.
- If you think you found a bug, please file it in Bugzilla. Thanks! Pete User:563683308
[edit] ORDER BY is case sensitive
This isn't ideal... any way around it so that you can get results sorted in natural order? - Robin 08:36, 10 March 2009 (PDT)
[edit] sql style joins?
Are there any plans for adding joins to FQL?
.
