0
I am 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 column 'unit', to which I assign the value '1' to have equally distributed, 4 values - say, by way of example the values: 1,41,51,61.
Thus, if my query above returned 100 lines, the "unit" column would have the first 25 lines with the value '1', the subsequent 25 lines the value '41', then 51 and so on.
If it were only 2 values, I could use the clause "top 50 Percent", but since there are 4, I don’t know how to make it work. Is there any way to do in the SQL code itself? Or I need to extract the data and do it manually via excel, as I have done?
Nugo, the question is not clear, I suggest example with more details and tb share the code
sql
– Ricardo Pontual
Thank you for your help, I’ve rephrased my question, I think it’s clearer now!
– Nugo Sunes
What is the criterion for sorting the result of the query to generate values for the column
unidade
?– José Diz