0
I have the following consultation code:
SELECT
AC.DT_AGENDA AS DATA,
ME.DS_MULTI_EMPRESA AS EMPRESA,
AC.CD_UNIDADE_ATENDIMENTO AS CD_UNID_ATENDIMENTO,
UA.DS_UNIDADE_ATENDIMENTO AS UNIDADE_ATENDIMENTO,
COUNT(IAC.NM_PACIENTE) AS TOTAL_MARCADOS,
COUNT(IAC.CD_ATENDIMENTO) AS ATENDIDOS
FROM AGENDA_CENTRAL AC
INNER JOIN IT_AGENDA_CENTRAL IAC ON AC.CD_AGENDA_CENTRAL = IAC.CD_AGENDA_CENTRAL
INNER JOIN UNIDADE_ATENDIMENTO UA ON UA.CD_UNIDADE_ATENDIMENTO = AC.CD_UNIDADE_ATENDIMENTO
INNER JOIN MULTI_EMPRESAS ME ON ME.CD_MULTI_EMPRESA = AC.CD_MULTI_EMPRESA
WHERE IAC.NM_PACIENTE IS NOT NULL
GROUP BY AC.CD_UNIDADE_ATENDIMENTO,
UA.DS_UNIDADE_ATENDIMENTO,
ME.DS_MULTI_EMPRESA,
AC.DT_AGENDA
I want to know based on count
, how many percent represents the ATENDIDOS
about count TOTAL_MARCADOS
.
That is to say,
10 marked 5 Attended 50% were met from the total marked.
Didn’t roll, this float Convert works for oracle? Gives Error Ora936 Expression not found, I thought it was just a ')' that was missing to close the expression, but not.
– Robinho Gomes
You’re right. See the edit. Removing CONVERT should get the desired result.
– bruno
That’s exactly what I did and it worked. Thank you!
– Robinho Gomes