stechsla Posted January 6, 2006 Share Posted January 6, 2006 What I want to accomplish seems very simple, but I can't get figure it out. I have 2 columns in my table that I want to manipulate:ActualHoursEstimatedHoursI want to create a third column in the same table called PercentComplete, which is computed by ActualHours / EstimatedHours.I've only seem examples that create new tables. I haven't seen anything that allows me to compute values based on information in the same table.I know this seems so simple, and the solution probably is, but unfortunately I'm stumped. Any help would be greatly appreciated.Thanks! Link to comment Share on other sites More sharing options...
aspnetguy Posted January 6, 2006 Share Posted January 6, 2006 SELECT ActualHours, EstimatedHours, (ActualHours/EstimatedHours) AS PercentCompleteFROM TableName That should work Link to comment Share on other sites More sharing options...
pulpfiction Posted January 6, 2006 Share Posted January 6, 2006 HiThis will create a new column, if this is what you need.....ALTER TABLE TablenameADD PercentComplete AS (ActualHours/EstimatedHours) Link to comment Share on other sites More sharing options...
aspnetguy Posted January 6, 2006 Share Posted January 6, 2006 I wasn;t sure what you want...do you want a third column when the query is displayed or do you actually want to add a 3rd column to the table?I would go with the third column on on display...why maintain a thrid column in hte table when it is just based on values the table already has. Link to comment Share on other sites More sharing options...
stechsla Posted January 9, 2006 Author Share Posted January 9, 2006 I wasn;t sure what you want...do you want a third column when the query is displayed or do you actually want to add a 3rd column to the table?I would go with the third column on on display...why maintain a thrid column in hte table when it is just based on values the table already has.<{POST_SNAPBACK}> Link to comment Share on other sites More sharing options...
stechsla Posted January 9, 2006 Author Share Posted January 9, 2006 Worked like a charm. Thanks everyone! I really appreciate your help. <{POST_SNAPBACK}> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now