Bom dia. Estou tendo dificuldades de criar Union com mais de 50 campos, ao rodar diz que a consulta é muito complexa. Tem como solucionar isso nas configurações do Access? Obrigada.
3 participantes
[Resolvido]Union com mais de 50 campos
icruznina- Intermediário
- Respeito às regras :
Sexo :
Localização :
Mensagens : 69
Registrado : 03/08/2015
- Mensagem nº1
[Resolvido]Union com mais de 50 campos
Alexandre Fim- Developer
- Respeito às regras :
Sexo :
Localização :
Mensagens : 3492
Registrado : 13/12/2016
- Mensagem nº2
Re: [Resolvido]Union com mais de 50 campos
Ivone bom dia,
As tabelas que fazem parte da UNION deve ter os mesmos campos.
Se possível, poste aqui seu banco de dados(somente partes envolvidas) para analise.
Grato.
As tabelas que fazem parte da UNION deve ter os mesmos campos.
Se possível, poste aqui seu banco de dados(somente partes envolvidas) para analise.
Grato.
.................................................................................
Marcar tópico como Resolvido: clique aqui
Postar anexos no fórum: clique aqui
Sistemas e Tecnologia Ltda
icruznina- Intermediário
- Respeito às regras :
Sexo :
Localização :
Mensagens : 69
Registrado : 03/08/2015
- Mensagem nº3
respondendo
eu sempre faço as unions retirando diretamente das tabelas, porém, de um tempo pra cá, faço algumas consultas e junto esses resultados na union, parece que o resultado sai mais rapido, so que não aceita mais de 50 campos, mesmo retirando diretamente das tabelas. Resultado: tive que dividir um relatorio consolidade de janeiro a dezembro em 2, de janeiro a junho e julho a dezembro, porque não roda. Daí, pensei ser uma limitação do Access, e de repente alguém aí já passou por isso. Ou será uma limitação do SQL?
Alexandre Fim- Developer
- Respeito às regras :
Sexo :
Localização :
Mensagens : 3492
Registrado : 13/12/2016
- Mensagem nº4
Re: [Resolvido]Union com mais de 50 campos
O número máximo de colunas que o Access suporta é 255.
Talvez vc esteja utilizando UNION ALL para todas as tabelas, e desta forma, o Access conta o nro de colunas de todas as tabelas.
Se vc tiver utilizando 6 tabelas com 50 campos cada 6x50 = 300), o Access vai gerar erro por número de colunas.
Verifique também se existem campos calculados e também Texto Longo (Memorando). Estes costumam dar erros também.
boa sorte.
Talvez vc esteja utilizando UNION ALL para todas as tabelas, e desta forma, o Access conta o nro de colunas de todas as tabelas.
Se vc tiver utilizando 6 tabelas com 50 campos cada 6x50 = 300), o Access vai gerar erro por número de colunas.
Verifique também se existem campos calculados e também Texto Longo (Memorando). Estes costumam dar erros também.
boa sorte.
.................................................................................
Marcar tópico como Resolvido: clique aqui
Postar anexos no fórum: clique aqui
Sistemas e Tecnologia Ltda
icruznina- Intermediário
- Respeito às regras :
Sexo :
Localização :
Mensagens : 69
Registrado : 03/08/2015
- Mensagem nº5
Imagem do problema
segue uma imagem da situação
Última edição por icruznina em 10/2/2020, 13:11, editado 1 vez(es)
Alexandre Fim- Developer
- Respeito às regras :
Sexo :
Localização :
Mensagens : 3492
Registrado : 13/12/2016
- Mensagem nº6
Re: [Resolvido]Union com mais de 50 campos
Ops...não veio a imagem.
Se possivel, poste aqui seu banco de dados (omente partes envolvidas) para analise.
Se possivel, poste aqui seu banco de dados (omente partes envolvidas) para analise.
.................................................................................
Marcar tópico como Resolvido: clique aqui
Postar anexos no fórum: clique aqui
Sistemas e Tecnologia Ltda
icruznina- Intermediário
- Respeito às regras :
Sexo :
Localização :
Mensagens : 69
Registrado : 03/08/2015
- Mensagem nº7
copia do texto da union
SELECT COUNT(*) AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA TOTAL INSC] AS TOTALSCFV
WHERE (TOTALSCFV.IDADEC<=5) UNION ALL
SELECT 0 AS TOT0A5, COUNT(*) AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA TOTAL INSC] AS TOTALSCFV
WHERE (TOTALSCFV.IDADEC BETWEEN 6 AND 11) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, COUNT(*) AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA TOTAL INSC] AS TOTALSCFV
WHERE (TOTALSCFV.IDADEC BETWEEN 12 AND 14) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, COUNT(*) AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA TOTAL INSC] AS TOTALSCFV
WHERE (TOTALSCFV.IDADEC BETWEEN 15 AND 17) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, COUNT(*) AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA TOTAL INSC] AS TOTALSCFV
WHERE (TOTALSCFV.IDADEC BETWEEN 18 AND 29) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, COUNT(*) AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA TOTAL INSC] AS TOTALSCFV
WHERE ((TOTALSCFV.IDADET BETWEEN 18 AND 29) AND (TOTALSCFV.COMPOS is null)) union all
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, COUNT(*) AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA TOTAL INSC] AS TOTALSCFV
WHERE (TOTALSCFV.IDADEC BETWEEN 30 AND 59) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, COUNT(*) AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA TOTAL INSC] AS TOTALSCFV
WHERE ((TOTALSCFV.IDADET BETWEEN 30 AND 59) AND (TOTALSCFV.COMPOS is null)) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, COUNT(*) AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA TOTAL INSC] AS TOTALSCFV
WHERE (TOTALSCFV.IDADEC >=60) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, COUNT(*) AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA TOTAL INSC] AS TOTALSCFV
WHERE ((TOTALSCFV.IDADET >=60) AND (TOTALSCFV.COMPOS is null)) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, COUNT(*) AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA INCLU] AS INCLUSCFV
WHERE (([INCLUSCFV].[DATA INSCRIÇÃO]) Between [DATA INICIAL] And [DATA FINAL]) AND ([INCLUSCFV].[IdadeC] <=5) AND (([INCLUSCFV].[DATA SAÍDA]) Is Null) union all
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, COUNT(*) AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA INCLU] AS INCLUSCFV
WHERE (([INCLUSCFV].[DATA INSCRIÇÃO]) Between [DATA INICIAL] And [DATA FINAL]) AND ([INCLUSCFV].IDADEC BETWEEN 6 AND 11) AND (([INCLUSCFV].[DATA SAÍDA]) Is Null) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, COUNT(*) AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA INCLU] AS INCLUSCFV
WHERE (([INCLUSCFV].[DATA INSCRIÇÃO]) Between [DATA INICIAL] And [DATA FINAL]) AND ([INCLUSCFV].IDADEC BETWEEN 12 AND 14) AND (([INCLUSCFV].[DATA SAÍDA]) Is Null) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, COUNT(*) AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA INCLU] AS INCLUSCFV
WHERE (([INCLUSCFV].[DATA INSCRIÇÃO]) Between [DATA INICIAL] And [DATA FINAL]) AND ([INCLUSCFV].IDADEC BETWEEN 15 AND 17) AND (([INCLUSCFV].[DATA SAÍDA]) Is Null) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, COUNT(*) AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA INCLU] AS INCLUSCFV
WHERE (([INCLUSCFV].[DATA INSCRIÇÃO]) Between [DATA INICIAL] And [DATA FINAL]) AND ([INCLUSCFV].IDADEC BETWEEN 18 AND 29) AND (([INCLUSCFV].[DATA SAÍDA]) Is Null) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, COUNT(*) AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA INCLU] AS INCLUSCFV
WHERE (([INCLUSCFV].[DATA INSCRIÇÃO]) Between [DATA INICIAL] And [DATA FINAL]) AND (INCLUSCFV.IDADET BETWEEN 18 AND 29) AND ([INCLUSCFV].[COMPOS] is null) AND (([INCLUSCFV].[DATA SAÍDA]) Is Null) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, COUNT(*) AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA INCLU] AS INCLUSCFV
WHERE (([INCLUSCFV].[DATA INSCRIÇÃO]) Between [DATA INICIAL] And [DATA FINAL]) AND (INCLUSCFV.IDADEC BETWEEN 30 AND 59) AND (([INCLUSCFV].[DATA SAÍDA]) Is Null) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, COUNT(*) AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA INCLU] AS INCLUSCFV
WHERE (([INCLUSCFV].[DATA INSCRIÇÃO]) Between [DATA INICIAL] And [DATA FINAL]) AND (INCLUSCFV.IDADET BETWEEN 30 AND 59) AND ([INCLUSCFV].[COMPOS] is null) AND (([INCLUSCFV].[DATA SAÍDA]) Is Null) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, COUNT(*) AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA INCLU] AS INCLUSCFV
WHERE (([INCLUSCFV].[DATA INSCRIÇÃO]) Between [DATA INICIAL] And [DATA FINAL]) AND (INCLUSCFV.IDADEC >=60) AND (([INCLUSCFV].[DATA SAÍDA]) Is Null) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, COUNT(*) AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA INCLU] AS INCLUSCFV
WHERE (([INCLUSCFV].[DATA INSCRIÇÃO]) Between [DATA INICIAL] And [DATA FINAL]) AND (INCLUSCFV.IDADET >=60) AND ([INCLUSCFV].[COMPOS] is null) AND (([INCLUSCFV].[DATA SAÍDA]) Is Null) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, COUNT(*) AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA EXCLU] AS EXCLUSCFV
WHERE (([EXCLUSCFV].[DATA SAÍDA]) Between [DATA INICIAL] And [DATA FINAL]) AND (EXCLUSCFV.IDADEC <=5) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, COUNT(*) AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA EXCLU] AS EXCLUSCFV
WHERE (([EXCLUSCFV].[DATA SAÍDA]) Between [DATA INICIAL] And [DATA FINAL]) AND (EXCLUSCFV.IDADEC BETWEEN 6 AND 11) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, COUNT(*) AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA EXCLU] AS EXCLUSCFV
WHERE (([EXCLUSCFV].[DATA SAÍDA]) Between [DATA INICIAL] And [DATA FINAL]) AND (EXCLUSCFV.IDADEC BETWEEN 12 AND 14) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, COUNT(*) AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA EXCLU] AS EXCLUSCFV
WHERE (([EXCLUSCFV].[DATA SAÍDA]) Between [DATA INICIAL] And [DATA FINAL]) AND (EXCLUSCFV.IDADEC BETWEEN 15 AND 17) UNION ALL
.........(recortei porque não enviou)
..............
...........
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, COUNT(*) AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX 60MAIS SIT PRIORI COMPO] UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, COUNT(*) AS SIT60MT
FROM [PERFIL SCFV FX 60MAIS SIT PRIORI TITULAR];
como vc pode perceber, são 50 campos. quando eu divido, roda a consulta
quando eu elimino esse ultimo select a consulta roda
FROM [PERFIL SCFV FX ETARIA TOTAL INSC] AS TOTALSCFV
WHERE (TOTALSCFV.IDADEC<=5) UNION ALL
SELECT 0 AS TOT0A5, COUNT(*) AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA TOTAL INSC] AS TOTALSCFV
WHERE (TOTALSCFV.IDADEC BETWEEN 6 AND 11) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, COUNT(*) AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA TOTAL INSC] AS TOTALSCFV
WHERE (TOTALSCFV.IDADEC BETWEEN 12 AND 14) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, COUNT(*) AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA TOTAL INSC] AS TOTALSCFV
WHERE (TOTALSCFV.IDADEC BETWEEN 15 AND 17) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, COUNT(*) AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA TOTAL INSC] AS TOTALSCFV
WHERE (TOTALSCFV.IDADEC BETWEEN 18 AND 29) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, COUNT(*) AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA TOTAL INSC] AS TOTALSCFV
WHERE ((TOTALSCFV.IDADET BETWEEN 18 AND 29) AND (TOTALSCFV.COMPOS is null)) union all
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, COUNT(*) AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA TOTAL INSC] AS TOTALSCFV
WHERE (TOTALSCFV.IDADEC BETWEEN 30 AND 59) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, COUNT(*) AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA TOTAL INSC] AS TOTALSCFV
WHERE ((TOTALSCFV.IDADET BETWEEN 30 AND 59) AND (TOTALSCFV.COMPOS is null)) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, COUNT(*) AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA TOTAL INSC] AS TOTALSCFV
WHERE (TOTALSCFV.IDADEC >=60) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, COUNT(*) AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA TOTAL INSC] AS TOTALSCFV
WHERE ((TOTALSCFV.IDADET >=60) AND (TOTALSCFV.COMPOS is null)) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, COUNT(*) AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA INCLU] AS INCLUSCFV
WHERE (([INCLUSCFV].[DATA INSCRIÇÃO]) Between [DATA INICIAL] And [DATA FINAL]) AND ([INCLUSCFV].[IdadeC] <=5) AND (([INCLUSCFV].[DATA SAÍDA]) Is Null) union all
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, COUNT(*) AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA INCLU] AS INCLUSCFV
WHERE (([INCLUSCFV].[DATA INSCRIÇÃO]) Between [DATA INICIAL] And [DATA FINAL]) AND ([INCLUSCFV].IDADEC BETWEEN 6 AND 11) AND (([INCLUSCFV].[DATA SAÍDA]) Is Null) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, COUNT(*) AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA INCLU] AS INCLUSCFV
WHERE (([INCLUSCFV].[DATA INSCRIÇÃO]) Between [DATA INICIAL] And [DATA FINAL]) AND ([INCLUSCFV].IDADEC BETWEEN 12 AND 14) AND (([INCLUSCFV].[DATA SAÍDA]) Is Null) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, COUNT(*) AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA INCLU] AS INCLUSCFV
WHERE (([INCLUSCFV].[DATA INSCRIÇÃO]) Between [DATA INICIAL] And [DATA FINAL]) AND ([INCLUSCFV].IDADEC BETWEEN 15 AND 17) AND (([INCLUSCFV].[DATA SAÍDA]) Is Null) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, COUNT(*) AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA INCLU] AS INCLUSCFV
WHERE (([INCLUSCFV].[DATA INSCRIÇÃO]) Between [DATA INICIAL] And [DATA FINAL]) AND ([INCLUSCFV].IDADEC BETWEEN 18 AND 29) AND (([INCLUSCFV].[DATA SAÍDA]) Is Null) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, COUNT(*) AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA INCLU] AS INCLUSCFV
WHERE (([INCLUSCFV].[DATA INSCRIÇÃO]) Between [DATA INICIAL] And [DATA FINAL]) AND (INCLUSCFV.IDADET BETWEEN 18 AND 29) AND ([INCLUSCFV].[COMPOS] is null) AND (([INCLUSCFV].[DATA SAÍDA]) Is Null) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, COUNT(*) AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA INCLU] AS INCLUSCFV
WHERE (([INCLUSCFV].[DATA INSCRIÇÃO]) Between [DATA INICIAL] And [DATA FINAL]) AND (INCLUSCFV.IDADEC BETWEEN 30 AND 59) AND (([INCLUSCFV].[DATA SAÍDA]) Is Null) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, COUNT(*) AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA INCLU] AS INCLUSCFV
WHERE (([INCLUSCFV].[DATA INSCRIÇÃO]) Between [DATA INICIAL] And [DATA FINAL]) AND (INCLUSCFV.IDADET BETWEEN 30 AND 59) AND ([INCLUSCFV].[COMPOS] is null) AND (([INCLUSCFV].[DATA SAÍDA]) Is Null) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, COUNT(*) AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA INCLU] AS INCLUSCFV
WHERE (([INCLUSCFV].[DATA INSCRIÇÃO]) Between [DATA INICIAL] And [DATA FINAL]) AND (INCLUSCFV.IDADEC >=60) AND (([INCLUSCFV].[DATA SAÍDA]) Is Null) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, COUNT(*) AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA INCLU] AS INCLUSCFV
WHERE (([INCLUSCFV].[DATA INSCRIÇÃO]) Between [DATA INICIAL] And [DATA FINAL]) AND (INCLUSCFV.IDADET >=60) AND ([INCLUSCFV].[COMPOS] is null) AND (([INCLUSCFV].[DATA SAÍDA]) Is Null) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, COUNT(*) AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA EXCLU] AS EXCLUSCFV
WHERE (([EXCLUSCFV].[DATA SAÍDA]) Between [DATA INICIAL] And [DATA FINAL]) AND (EXCLUSCFV.IDADEC <=5) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, COUNT(*) AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA EXCLU] AS EXCLUSCFV
WHERE (([EXCLUSCFV].[DATA SAÍDA]) Between [DATA INICIAL] And [DATA FINAL]) AND (EXCLUSCFV.IDADEC BETWEEN 6 AND 11) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, COUNT(*) AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA EXCLU] AS EXCLUSCFV
WHERE (([EXCLUSCFV].[DATA SAÍDA]) Between [DATA INICIAL] And [DATA FINAL]) AND (EXCLUSCFV.IDADEC BETWEEN 12 AND 14) UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, COUNT(*) AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX ETARIA EXCLU] AS EXCLUSCFV
WHERE (([EXCLUSCFV].[DATA SAÍDA]) Between [DATA INICIAL] And [DATA FINAL]) AND (EXCLUSCFV.IDADEC BETWEEN 15 AND 17) UNION ALL
.........(recortei porque não enviou)
..............
...........
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, COUNT(*) AS SIT60MC, 0 AS SIT60MT
FROM [PERFIL SCFV FX 60MAIS SIT PRIORI COMPO] UNION ALL
SELECT 0 AS TOT0A5, 0 AS TOT6A11, 0 AS TOT12A14, 0 AS TOT15A17, 0 AS TOT18A29C, 0 AS TOT18A29T, 0 AS TOT30A59C, 0 AS TOT30A59T, 0 AS TOT60MC, 0 AS TOT60MT, 0 AS INCLU0A5, 0 AS INCLU6A11, 0 AS INCLU12A14, 0 AS INCLU15A17, 0 AS INCLU18A29C, 0 AS INCLU18A29T, 0 AS INCLU30A59C, 0 AS INCLU30A59T, 0 AS INCLU60MC, 0 AS INCLU60MT, 0 AS EXCLU0A5, 0 AS EXCLU6A11, 0 AS EXCLU12A14, 0 AS EXCLU15A17, 0 AS EXCLU18A29C, 0 AS EXCLU18A29T, 0 AS EXCLU30A59C, 0 AS EXCLU30A59T, 0 AS EXCLU60MC, 0 AS EXCLU60MT, 0 AS PRE0A5, 0 AS PRE6A11, 0 AS PRE12A14, 0 AS PRE15A17, 0 AS PRE18A29C, 0 AS PRE18A29T, 0 AS PRE30A59C, 0 AS PRE30A59T, 0 AS PRE60C, 0 AS PRE60T, 0 AS SIT0A5, 0 AS SIT6A11, 0 AS SIT12A14, 0 AS SIT15A17, 0 AS SIT18A29C, 0 AS SIT18A29T, 0 AS SIT30A59C, 0 AS SIT30A59T, 0 AS SIT60MC, COUNT(*) AS SIT60MT
FROM [PERFIL SCFV FX 60MAIS SIT PRIORI TITULAR];
como vc pode perceber, são 50 campos. quando eu divido, roda a consulta
quando eu elimino esse ultimo select a consulta roda
Alexandre Neves- Moderador Global
- Respeito às regras :
Sexo :
Localização :
Mensagens : 8498
Registrado : 05/11/2009
- Mensagem nº8
Re: [Resolvido]Union com mais de 50 campos
Boa tarde,
Pelo que percebi da consulta, trata-se de consulta UNION atípica, podendo ser muito melhorada
1- Nomeie de forma normalizada (nomes sem espaços-em vez de DATA FINAL utilize DataFinal)
2- Não utilize Campo is Null mas IsNull(Campo)
3- coloque a expressão da consulta que pretende utilizar para poder ajudar a simplificar
Pelo que percebi da consulta, trata-se de consulta UNION atípica, podendo ser muito melhorada
1- Nomeie de forma normalizada (nomes sem espaços-em vez de DATA FINAL utilize DataFinal)
2- Não utilize Campo is Null mas IsNull(Campo)
3- coloque a expressão da consulta que pretende utilizar para poder ajudar a simplificar
.................................................................................
Access 2010. Mande bd que dê para testar (indique a versão). Não peça para fazer o que já tem feito. Dê todos os detalhes.
Não coloquem entraves como senhas, esconder controlos, etc. Disponibilizem o mais limpo possível
Só respondo a mensagens privadas, se forem de assunto privado; às outras não respondo.
Quem trabalha e mata a fome não come o pão de ninguém; mas quem não trabalha e come, come sempre o pão de alguém. António Aleixo
icruznina- Intermediário
- Respeito às regras :
Sexo :
Localização :
Mensagens : 69
Registrado : 03/08/2015
- Mensagem nº9
consegui
Bom dia! Dividi a consulta e 2, criei a sum dessas 2 unions, juntei as 2 sums e uma nova consulta, deu certo. Obrigada a todos.