I want to select a column and remove(replace with space) any line feeds or carriage returns and I want to get only the first 40 characters in the column after the replace.
Here is the query I tried but I get
select date, REPLACE(LEFT(message, '\r', ' '), 30) from table1 where message like 'testing%'
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' ' '), 30) from events_cleared where message like 'testing%' ' at line 1
You have the ordering of your arguments incorrect (you have passed the
REPLACE arguments to
LEFT). Try this:
select date, REPLACE(LEFT(message, 30), '\r', ' ') from table1 where message like 'testing%'
- Combining multiple rows into a single row with multiple columns
- Could not find function plot.gam
- how to solve this query in mysql?
- When to use single quotes, double quotes, and back ticks in MySQL
- I get a query error 'unknown column' while the column exists
- PHP 7.2.2 + mysql 8.0 PDO gives: authentication method unknown to the client [caching_sha2_password]
- How to sum of column by depending other column in my sql?
- What is this : sign after a variable JS syntax?
- Joining 2 tables in SELECT(MYSQL/PHP)
- Compare two MySQL Datetime columns