View Full Version : SELECT problem

01-11-2007, 09:01 AM
hi,i have a prob here....for eg,

SELECT name, birth, CURDATE(),
-> (YEAR(CURDATE())-YEAR(birth))
-> - (RIGHT(CURDATE(),5)<RIGHT(birth,5))
-> AS age
-> FROM table;

can i change the SQL statement above to INSERT statement....????it is bcoz i hav the prob when i jz use SELECT statement....is it possible to use the statement above n apply to INSERT statement????

thank u

01-11-2007, 09:49 AM
What is this crazy language you speak? Where are all the vowels? This forum isn't an SMS, you don't have a character limit...

Without seeing more details, I can only assume you're after something like:

INSERT INTO table(name, birth)
VALUES ('John', '1976/10/23')

01-11-2007, 11:58 AM
sorry for any inconvenience....i mean this condition...
-->(YEAR(CURDATE())-YEAR(birth))- (RIGHT(CURDATE(),5)<RIGHT(birth,5)) AS age
can i put this condition combine with the INSERT statement....bcoz i hav found this example from Internet....but is using SELECT....i jz wan to ask is it possible to use the condition above(red color) combine with the INSERT statement???

thank u

01-11-2007, 12:59 PM
Don't store that. Just store the year of birth. You use that type of query when you need to calculate if someone has already had a birthday or not this year.