Post by Pierhere;2036188
那给点提示也好啊!
不知道楼主解决了没.我先来凑凑热闹吧.很久没写SQL了,估计有很多错误,就勉强当是提示吧。
SELECT President.name as p_name, President.spouse_name as s_name, DATEDIFF(y, President.spouse_dob, President.marriage_year) as age_wedding, COUNT(Children.father_name)
FROM President, Children
WHERE Children.father_name = p_name AND (SELECT COUNT(Children.father_name) FROM Children) <= ROUND((45-President.marriage_year)/5) |