Number of times of a character in an SQL statement

0

Hi, I have a problem with a sql statement, I want you to show me the number of times a letter is repeated in this case H in a table

SELECT  SUBSTR(TRIM(CURP),11,1) AS GENERO  FROM * 'tbl_name'

there is only the letter H or M shown for every record in the table

    
asked by Juan Carlos Olivera Gomez 27.04.2018 в 00:01
source

1 answer

0

In order to respond to your concern it would be necessary to use the sentence "GROUP BY" as I enunciate below:

SELECT SUBSTR(TRIM(CURP),11,1) AS GENERO,
      count(*) AS Empleados 
FROM NombreDeTuTbl
GROUP BY SUBSTR(TRIM(CURP),11,1)

I hope you find it useful, greetings.

Bibliography: link

    
answered by 27.04.2018 в 00:08