226k views
2 votes
How to remove comma in sql select query

User Max Usanin
by
7.4k points

1 Answer

2 votes

Final answer:

To remove a comma from a string in a SQL SELECT query, use the REPLACE() function to replace commas with an empty string in the specified column.

Step-by-step explanation:

To remove a comma from a string in a SQL SELECT query, you can use the REPLACE() function. This function replaces all occurrences of a specified substring with another substring within a given string. Here's an example of how to use REPLACE() to remove commas from a column named 'ColumnName' in a table called 'TableName':

SELECT REPLACE(ColumnName, ',', '') AS NewColumnName FROM TableName;

This will select all records from 'TableName', replacing any commas in the 'ColumnName' with an empty string, effectively removing them.

User LordGrim
by
8.3k points