Sunday, 8 September 2013

Creating view with calculated columns

Creating view with calculated columns

Okay guys,
So i have a table with various columns and around 40 records, what i need
to do is create a view that only displays 3 of the columns, and then
calculates a new column based on results from the other columns.
The columns are as follows, JobID, SDate & FDate (Start Date and
FinishDate), What i need is a new column called grades within this view
that if start date and finish date are the same then 'A+', If it took more
than one day then 'A', If more than two days then 'B', Else 'C'.
What would be the best approach to this, I'm quite new to SQL and my
experience is somewhat limited.
I'm using SQL Server Management Studio R2. And yes it must be a view as
this was the task given to me.
Thanks in advance!

No comments:

Post a Comment