Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

derived field for age

Status
Not open for further replies.

rumplesteelskin

IS-IT--Management
Oct 30, 2003
8
0
0
US
I need help in creating a sql derived field for people between 12 - 18
 
What is it that you want the derived field to do - return just those persons who are between 12-18?

Also, what table/column have you used for age?
 
I'm on Oracal 9 and don't write SQL directly so my reply may not help. However, it may give you some ideas.

Since you haven't identified which tables/columns you are currently using in your report I'm just going to give you ideas.

If you're looking to create a simple report with only those employees between 12 and 18 the easiest choice is to use the Employees table and the Age column. Then use Selections and specify: data field Employees.Age is between 12 and 18. Because you are using the Employees table this will only reflect current employees.

The other choice is to use Personal Data and the Birthdate column (query). Create a derived field for Age:
Trunc((months_between (sysdate, "PD"."Birthdate"))/12, 0). Then write the Selection similar to the above version: derived field Age is between 12 and 18.

Sorry if I didn't provide the answer/direction you were looking for.
 
You need to create a derived field as listed below.

(TO_CHAR(SYSDATE,'YYYY')) -
TO_CHAR("PS_PERSONAL_DATA"."BIRTHDATE",'YYYY')

Then in your selection criteria please select the following for a single age seletion

derived field YY is equal to number 12

or for mulitple age range use the following selection criteria

derived field YY is between number 12 and number 15

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top