我有两张桌子。
我想找到将墙设置为公共视图并且年龄超过24岁的用户?
Select f.facebook_ID from fbuser f, wall w
WHERE
(w.public_view='y')
AND
(f.facebook_ID=w.facebook_ID)
AND
(select FLOOR( MONTHS_BETWEEN( CURRENT_DATE, f.date_of_birth ) / 12 )
as person_age from fbuser where person_age >=24;
答案 0 :(得分:1)
SELECT
f.facebook_ID
FROM fbuser f, wall w
WHERE
(f.facebook_ID=w.facebook_ID)
AND
(w.public_view='y')
AND
( (MONTHS_BETWEEN( CURRENT_DATE, f.date_of_birth )/12) >=24);