We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,548 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

how to create a derived attribute?

there is a table. both "age" and "DOB" columns are there.
how to give a SQL command to make "AGE" a derived attribute from "DOB"?
thanks

3
Contributors
4
Replies
2 Months
Discussion Span
6 Months Ago
Last Updated
5
Views
silvercats
Posting Pro in Training
410 posts since Apr 2011
Reputation Points: 20
Solved Threads: 2
Skill Endorsements: 0

Not quite sure what you're asking for here. What do you mean by "derived attribute"?

If it is simply to derive an "AGE" column in a select statement, then you can just use the DATEDIFF function and specify the years between the DOB column and GetDate().

If you're looking for a "derived table", that's really nothing more than joining to a parenthesized "Select" statement. Frankly, in most cases you're better off using straight joins.

If you're talking about a Derived Column transformation in SSIS, then there's a Derived Column Transformation Editor in BIDS that will expose all the properties you need.

If none of these answer your question, please clarify what you're asking for, and perhaps describe more about your scenario.

BitBlt
Practically a Posting Shark
894 posts since Feb 2011
Reputation Points: 482
Solved Threads: 148
Skill Endorsements: 14

Hi im a beginner in mysql land and i need exactly this i need to derive AGE from my D.O.B column i am wondering if you could explain whether i need to do this...

If it is simply to derive an "AGE" column in a select statement, then you can just use the DATEDIFF function and specify the years between the DOB column and GetDate().

and whether you could break it down more simply...

i know im asking alot but we all have to learn ..

hopefully

barb :D

barb.saunders.5
Newbie Poster
3 posts since Dec 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

Hi, @barb.saunders.5 and welcome to DaniWeb.

Please note that this thread is for MS SQL, and you'd probably get a better answer if you posted in the MySQL database forum. There are syntax differences in the dialects of SQL for each of the platforms.

BitBlt
Practically a Posting Shark
894 posts since Feb 2011
Reputation Points: 482
Solved Threads: 148
Skill Endorsements: 14

Ok thank you :D

barb.saunders.5
Newbie Poster
3 posts since Dec 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page generated in 0.0685 seconds using 2.65MB