-2

I have scenario where I want to get the percentage of completion.

I have two columns and have to calculate third.

 vCompletedTasks | vTotalTasks | vPercentageCompleted

  63               66
  55               70
  35               50
  24               48                 50% 

I need to write a query which calculates third column, which is percentage.

Nick Krasnov
  • 26,886
  • 6
  • 61
  • 78
Ali Shahbaz
  • 825
  • 1
  • 7
  • 19

1 Answers1

0
select vCompletedTasks,vTotalTasks,convert(varchar(2),

((vCompletedTasks * 100) / vTotalTasks))+'%' as vPercentageCompleted

from TableName
Sandesh
  • 109
  • 7
  • Thanks appreciate your response :) – Ali Shahbaz Oct 31 '14 at 06:37
  • `convert()` function, in Oracle, has different purpose. Simply put, it cannot be used to convert a value to a specific data type, and `+` operator, in Oracle, cannot be used for "strings" concatenation. – Nick Krasnov Oct 31 '14 at 07:32
  • http://stackoverflow.com/questions/26669507/i-have-to-write-a-very-interesting-query-which-calculates-null-values-and-rows-w?noredirect=1#comment41939760_26669507 – Ali Shahbaz Oct 31 '14 at 07:35
  • if you guys can help to resolve the above one as well ... Thanks – Ali Shahbaz Oct 31 '14 at 07:35