Jump to content

Recommended Posts

hi,

 

I want to find the age from the date of birth,

 

this is my sql..

 

select

emp.E_ID as Code,

emp.E_Name as Name,

contry.Country_Name as Nationality,

emp.E_UID as ID,

empe.EE_Institution_Name as University,

empe.EE_Degree as Degree,

mm.Maj_Name as Specialization ,

expm.Exp_Name +' years'  as Experience, 

emp.E_Email as Email,

emp.E_Mobile as Mobile

from major mm

left join employee_education empe on empe.Maj_ID = mm.Maj_ID

left join employee emp on emp.E_ID = empe.E_ID

left join country contry on emp.E_Country = contry.Country_ID

left join experience_yrs_master expm on emp.Exp_ID = expm.Exp_ID

where 1 group by emp.E_ID

 

 

my Birthdate field is E_Birthday..

 

 

Please Help me..

 

thanks,

Link to comment
https://forums.phpfreaks.com/topic/233257-selecting-age-from-date-field/
Share on other sites

this is the answer

 

 

SELECT

emp.E_ID as Code,

emp.E_Name as Name,

contry.Country_Name as Nationality,

emp.E_UID as ID,

DATE_FORMAT( FROM_DAYS( TO_DAYS( NOW( ) ) - TO_DAYS( `E_Birthdate` ) ) , '%Y' ) +0 AS Age,

 

empe.EE_Institution_Name as University,

empe.EE_Degree as Degree,

mm.Maj_Name as Specialization ,

expm.Exp_Name +' years'  as Experience, 

emp.E_Email as Email,

emp.E_Mobile as Mobile,

emp.CV_Resume as Resume

from major mm

left join employee_education empe on empe.Maj_ID = mm.Maj_ID

left join employee emp on emp.E_ID = empe.E_ID

left join country contry on emp.E_Country = contry.Country_ID

left join experience_yrs_master expm on emp.Exp_ID = expm.Exp_ID

 

 

hi,

 

I want to find the age from the date of birth,

 

this is my sql..

 

select

emp.E_ID as Code,

emp.E_Name as Name,

contry.Country_Name as Nationality,

emp.E_UID as ID,

empe.EE_Institution_Name as University,

empe.EE_Degree as Degree,

mm.Maj_Name as Specialization ,

expm.Exp_Name +' years'  as Experience, 

emp.E_Email as Email,

emp.E_Mobile as Mobile

from major mm

left join employee_education empe on empe.Maj_ID = mm.Maj_ID

left join employee emp on emp.E_ID = empe.E_ID

left join country contry on emp.E_Country = contry.Country_ID

left join experience_yrs_master expm on emp.Exp_ID = expm.Exp_ID

where 1 group by emp.E_ID

 

 

my Birthdate field is E_Birthday..

 

 

Please Help me..

 

thanks,

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.