我正在编写一个应用程序,我在其中获取未来 30 天内生日的朋友列表,我也能够得到它,但是我的列表中遇到了一个小问题。
喜欢:我在接下来的 30 天内有 4 个朋友的生日,所以我得到了即将到来的 facebook 朋友生日的列表,但没有得到今天生日的朋友的名字
我想我在查询中遗漏了一些东西。
代码:
Calendar cal = Calendar.getInstance();
Date today = cal.getTime();
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
String today_formatted = formatter.format(today);
cal.add(Calendar.DATE, 30); //set number of days
String today_plus30_formatted = formatter.format(cal.getTime());
String query = "select name, birthday, uid, pic_square FROM user WHERE uid in (SELECT uid2 FROM friend WHERE uid1 = me()) AND birthday_date != 'null' AND birthday_date > '" + today_formatted + "'AND birthday_date < '" + today_plus30_formatted + "'ORDER BY birthday_date ASC";
如果我将使用下面的查询,所以我没有得到我的朋友列表:
String query = "select name, birthday, uid, pic_square FROM user WHERE uid in (SELECT uid2 FROM friend WHERE uid1 = me()) AND birthday_date != 'null' AND birthday_date > = '" + today_formatted + "'AND birthday_date < = '" + today_plus30_formatted + "'ORDER BY birthday_date ASC";