I need to create a select where it is placed in value of one column in another column which belong to different rows, using the criteria of the type column.
In other words, place the value of column_one in column_dos when type is = 'B'. Type 'C' should not be placed in column_dos. For example
id descripción tipo columna_uno columna_dos
1 grain A 1000
2 beans B 1000 (valor perteneciente a la columna_uno)
3 sugar C 2000
I'm trying something like this but I do not get the desired result
SELECT id, decripcion, tipo, columna_uno,
CASE WHEN tipo = 'B' THEN columna_uno end columna_dos
Is it possible to do this and what would it be like?
Thank you very much for the help.