Click here to Skip to main content
15,849,054 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good Day to all, i want to ask a small question.

I want to know if there is a way on how to create a field in a database that will update its field every-time a another field of it is compared in the computer's date.

Further Discussion:

For example i have a field and data like this.

| Name | Birth date | Age |
| Paul | 09/291993 | 19 |

and if the column birth date is equal to computers date then these will be the output.

| Name | Birth date | Age |
| Paul | 09/291993 | 20 |

is there a way or other way on how to do that?
Any code sample will be a great help. On this question im using MySQL Database.

Thank You. :)

1 solution

Normally this is called a "computed column", but these values are set when the row is inserted or updated, not when it's read.

What you're asking is normally done in the SELECT statement. You can find an example here[^].
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900