MySQL search for "$" (dollar sign) fails?
mysql, special-characters
Solution
The queries given will select the rows where `concept_description` contains a `$`, but I assume that you want to actually pull out the dollar amounts? If there's only ever just one dollar amount in a field it can be pulled out using
SELECT
SUBSTRING(
concept_description,
LOCATE('$', concept_description),
LOCATE(' ', concept_description, LOCATE('$', concept_description)) - LOCATE('$', concept_description)
)
FROM table
WHERE LOCATE('$', concept_description) > 0
This assume that the dollar amount is always followed by a space, and might need some fudging on the indexes. It's probably best to pull the full field out with a simple query, then use regular expressions to grab any dollar values.
Problem
Been asked to find dollar values across a large body of text. Can a search be performed on the dollar sign? If so, any examples/guidance would be most appreciated. Current query... ``` select * from concept where concept_description like '%$%'; ```