MySQL Forums
Forum List  »  Newbie

query
Posted by: rick wilkins
Date: July 19, 2005 06:28AM

I am running the below query and can not find how to get a value for the League field
as it is a calculated field now and in the past was a fixed field with 4 choices.
How can I now select the league from a menu (Tball, confederate, minor and youth)
and have the query complete

SELECT `Last Name First Name` , if(month( '2005-08-01') > month(Birthday) OR( month( '2005-08-01') = month(Birthday) AND dayofmonth( '2005-08-01') >= dayofmonth(Birthday)), year( '2005-08-01')-year(Birthday) ,year( '2005-08-01')-year(Birthday) -1 ) as Age, Birthday, Team, IF (Birthday > '1998-08-01', 'TBall', IF (Birthday > '1996-08-01', 'Confederate', IF (Birthday > '1994-08-01', 'Minor', IF (Birthday > '1992-08-01', 'Youth', 'Ineligible')))) AS League, Type
FROM players
WHERE Team = 'colname' AND League = 'colname1'
ORDER BY Type , Age DESC , 'Last Name First Name'

Options: ReplyQuote


Subject
Written By
Posted
query
July 19, 2005 06:28AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.