开发者

Select something (events, birthday, post etc) in date range

I try figure out something with fql and I made开发者_StackOverflow some select query which showing friends who have a birthday in selected day.

I can't figure it out how to make some time range in the query.

$fql_n = "SELECT uid, name, birthday_date FROM user 
WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) 
AND strlen(birthday_date) != 0 ORDER BY birthday_date"; 

The Facebook date is in format mm/dd/yyyy.


Both birthday_date and birthday are strings. There's really not a way to search on a range.

You could specify a list of dates and use IN

WHERE birthday_date IN ('05/30/1990','05/29/1990') 


you can specify the day you want to have birthday

SELECT name, birthday_date 
FROM user 
WHERE uid IN (
    SELECT uid2 
    FROM friend 
    WHERE uid1=me()
)
AND (strpos(lower(birthday_date),"08/01") >=0 OR strpos(lower(birthday_date),"08/02") >=0)

// this will fetch birthday for august 1 and 2, use birthday_date so you have MM/DD/YYYY format.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜