SELECT Name, doB, Age CURDATE() , (
YEAR(CURDATE()) - YEAR(F)
) - (RIGHT(CURDATE() , 5) < RIGHT(F, 5)) AS Ages
SELECT Name, DoB, Ages WHERE Age=20 As Age
FROM Table_
ORDER BY N
如果我只想顯示年齡列是臨時列的20歲的人的姓名,我該如何放置where AGES=20
?無法獲取特定的年齡來顯示
- 編輯 - 的oryginal查詢:
SELECT N, F, CURDATE() ,
(YEAR(CURDATE()) - YEAR(F))
- (RIGHT(CURDATE() , 5) < RIGHT(F, 5)) AS Age
FROM edad_ LIMIT 0 , 30
很難說,因爲問題中的select語句有語法錯誤且無法編譯。請先糾正查詢。 – krokodilko
選擇N,F,CURDATE(),( 年(CURDATE()) - 年(F)) - (RIGHT(CURDATE(),5)
user3330441