Show SQL result as integer

0

The human resources department needs to show the employee number, last name, salary and salary increased by 10.5% (expressed as a whole number) of each employee. I labeled the column as New Salary .

I do it like this:

SELECT [numero de empleado]
    ,apellido
    ,salario + (salario * 0.105) AS New_salary
FROM empleados

Perfect, I just need the values of the salary calculation to be whole. Any ideas? Currently he throws them at me this way:

  

3315.0000000

    
asked by Samuel Ignacio Susana Confesor 13.06.2017 в 18:17
source

2 answers

3

You can do it by making CAST to INT :

CAST((salario * 1.105) AS INT)

Code:

SELECT 
    [numero de empleado],
    apellido,
    salario,
    CAST((salario * 1.105) AS INT) as New_salary 
FROM empleados

Here you can see the demonstration of the solution

    
answered by 13.06.2017 / 18:23
source
0

what we could do to calculate the data that you want It would use Round ()

Where the Syntax is as follows:

SELECT ROUND(tu_columna ,decimales) FROM tu_tabla;
    
answered by 13.06.2017 в 18:22