I have a database named completo
, whose dados
table is:
id cpf nome
1 38831370570 joao da silva
2 27283620508 maria joaquina
3 94470661945 carlos eduardo
I would like to 'filter' all CPFs that contain a given digit in the ninth position, based on this:
"To determine in which Brazilian state a CPF was issued, it is necessary to obtain the last digit of the CPF, ignoring the two digits of control / verifiers An example of how to determine this number is the CPF number XXX.XXX.XX6- XX We highlight the last valid CPF number, ignoring the verifying digits. "
I want to search the bank for all CPFs in Rio de Janeiro, for example, according to this relation:
1. Distrito Federal, Goiás, Mato Grosso do Sul e Tocantins;
2. Pará, Amazonas, Acre, Amapá, Rondônia e Roraima;
3. Ceará, Maranhão e Piauí;
4. Pernambuco, Rio Grande do Norte, Paraíba e Alagoas;
5. Bahia e Sergipe;
6. Minas Gerais;
7. Rio de Janeiro e Espírito Santo;
8. São Paulo;
9. Paraná e Santa Catarina;
10.Rio Grande do Sul.