+ 2

If in a table, for gender column the males are marked as F and the females are marked as M by mistake. In one query how can we replace and correct this problem.

9th Sep 2016, 6:44 AM
Dushyant Sharma
3 ответов
+ 5
You can use case function. Here is the query : Update table_name set gender=(case gender when 'M' then 'F' else 'M' end) ;
9th Sep 2016, 7:19 AM
Kirtiranjan Sahoo
Kirtiranjan Sahoo - avatar
0
Is there any way to do it with replace function ?
9th Sep 2016, 7:41 AM
Dushyant Sharma
0
In replace function you can change only one value of a single column if you use this column using comma once again it will show an error of duplicate column name, you can't alternate the record at a time
9th Sep 2016, 8:44 AM
Kirtiranjan Sahoo
Kirtiranjan Sahoo - avatar