Views [message #10886] |
Sun, 22 February 2004 12:40 |
LT
Messages: 29 Registered: August 2003
|
Junior Member |
|
|
Hi All
I have a requirement to create a view that will be used to run a report in MSAccess. The purpose of creating the view is to speed up the report creation.
However, there is a field that I would like to have in my view that I would like to calculate based on a date of birth value.
Example - There is a 'Date of Birth' column in the view and I would like to calculate the time of life based on the date of birth and put it in my view. So say 'If less than 18 - Child else adult'.
I originally just put the DOB column in the view and told the users to use an expression in Access to calculate this but it is causing the report to take a long time to run.
Is there anyway I can calculate this automatically in my view during creation? Or does anyone else have any other ideas on how I could do this?
Regards.
|
|
|
|
Re: Views [message #10900 is a reply to message #10886] |
Mon, 23 February 2004 03:51 |
Shalini singh
Messages: 11 Registered: September 2002
|
Junior Member |
|
|
select (case
when DOB < '18' then 'child'
else 'Adult' end ) time_of_life
from T_age;
In above sql, u can use T_age the table name from which u have to slect the age. and can put as a column in the created view
|
|
|