← Back to team overview

maria-discuss team mailing list archive

Re: help - i'm not finding one sql function

 

wow! thanks kk i was trying to find a php like function
your idea is very nice :) thank you!

substr_count => (length(field)-length(replace(' ','',field)))

/)


2014-03-19 12:16 GMT-03:00 pslawek83 <pslawek83@xxxxx>:

> Hi Roberto,
> You'll have to replace char => empty and get the difference in length.
>
> SELECT (length("banana") - replace("n", "", "banana"))
>
> There's probably no "standard" function to do that.
>
>
> Dnia 19 marca 2014 15:51 Roberto Spadim <roberto@xxxxxxxxxxxxx>
> napisał(a):
>
>
>   hi guys, i'm not finding a function to return how many character i
> have, for example:
>
> "banana"
>
> i want a function that return 2 "n" characters, example:
> substr_count("banana","n") => 2
>
> sorry it a begginners question, but i didn't found it in mysql/mariadb
> manual
>
> --
> Roberto Spadim
> SPAEmpresarial
> Eng. Automação e Controle
>
>
>
>


-- 
Roberto Spadim
SPAEmpresarial
Eng. Automação e Controle

Follow ups

References