I'm extracting data from a table with the following query:
SELECT
[nu-cpf] as CPF, [nome segurado] as NOME, '' as IdentificacaoCliente,
'' as CodigoBeneficio,
CONCAT([nu-ddd],[nu-telefone]) TelefoneResidencial,
'' as TelefoneCelular,'' as TelefoneAlternativo,cast([dt-nasc] as date) as
DataNascimento, '1' as unidade
FROM
mac_all
And I need the 'unit' column, which I assign the value '1' to have equally distributed, 4 values - say, for example, the values: 1,41,51,61.
So, if my above query returns 100 rows, the "unit" column would have the first 25 rows with the value '1', the subsequent rows the value '41', then 51, and so on. p>
If it were only 2 values, I could use the "top 50 percent" clause, but since there are 4, I do not know the ways to make it work. Is there any way to do it in the SQL code itself? Or do I need to extract the data and do this manually via excel, how have I done?