Access - CONSULTA CONDICIONADA

 
Vista:

CONSULTA CONDICIONADA

Publicado por Joanna saavedra (2 intervenciones) el 16/11/2011 15:21:47
Cordial saludo,
Tengo una base de datos creada para un laboratorio, la tabla "identificacion de muestras" tiene unos campos si/no llamado "MACHOS", "HEMBRAS","POSITIVO","SOSPECHOSO", necesito realizar una consulta en cual pueda obtener los siguientes datos en diferentes columnas, para ser exportados a excel: "TOTAL MACHOS", "TOTAL HEMBRAS", "TOTAL MACHOS POSITIVOS", "TOTAL MACHOS SOSPECHOSOS", "TOTAL HEMBRAS POSITIVAS" "TOTAL HEMBRAS SOSPECHOSAS", no soy ingeniera asi que no tengo idea de sql o algun lenguaje de programación, este aporte seria fundamental para la eficiencia del uso de esta base de datos.
Gracias por su colaboracion
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

CONSULTA CONDICIONADA

Publicado por 2pl (2 intervenciones) el 16/11/2011 17:44:25
Salvo error u omisión la consulta debe ser asi
GENERO:iif(Not IsNull([MACHOS]);"MACHOS";"HEMBRAS")
TOTAL MACHOS:iif(Not IsNull([MACHOS]);1;0)
TOTAL HEMBRAS:iif(Not IsNull([HEMBRAS]);1;0)
TOTAL MACHOS POSITIVOS:iif(Not IsNull([MACHOS]) and not isnull([POSITIVO]);1;0))
TOTAL MACHOS SOSPECHOSOS:iif(Not IsNull([MACHOS]) and not isnull([SOSPECHOSO]);1;0))
TOTAL HEMBRAS POSITIVAS:iif(Not IsNull([HEMBRAS]) and not isnull([POSITIVO]);1;0))
TOTAL HEMBRAS SOSPECHOSAS:iif(Not IsNull([EMBRAS]) and not isnull([SOSPECHOSO]);1;0))
Tienes que agrupar por GENERO y el resto de los campos 'Suma'
Supongo que si es de un genero estarán marcados los correspondientes campos y los otros desmarcados
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

CONSULTA CONDICIONADA

Publicado por Joanna saavedra (2 intervenciones) el 17/11/2011 18:56:34
Gracias por tu colaboración y por favor perdona mi ignorancia, voy a describirte hasta donde llego en la consulta y a pedirte que me orientes un poco mas por favor! En diseño de consulta ya he creado la cuadricula con los siguientes campos: "MACHOS", "HEMBRAS","POSITIVOS","SOSPECHOSOS", he seleccionado totales y he agrupado "MACHOS","HEMBRAS" como suma, en un nuevo campo digite TOTAL DE MACHOS POSITIVOS: fui al generador de expresiones y escribi la expresion:iif(Not IsNull([MACHOS]) and not isnull([POSITIVO]);1;0)), y me arroja el siguiente error: La expresion que especificado tiene una sintaxis no valida, omitio un operando o un operador, escribio un caracter o una coma no validos, o escribio texto sin encerrarlo en comillas.

En realidad no estoy segura de que este haciendo lo correcto con las expresiones que me diste, por favor me puedes ayudar?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

CONSULTA CONDICIONADA

Publicado por 2pl (461 intervenciones) el 17/11/2011 22:25:54
Mandame la BD y te hago la consulta. Mi correo es antperlopARROBAono.com

TOTAL MACHOS POSITIVOS:iif(Not IsNull([MACHOS]) and not isnull([POSITIVO]);1;0)
TOTAL MACHOS SOSPECHOSOS:iif(Not IsNull([MACHOS]) and not isnull([SOSPECHOSO]);1;0)
TOTAL HEMBRAS POSITIVAS:iif(Not IsNull([HEMBRAS]) and not isnull([POSITIVO]);1;0)
TOTAL HEMBRAS SOSPECHOSAS:iif(Not IsNull([EMBRAS]) and not isnull([SOSPECHOSO]);1;0)
Tienes que agrupar por GENERO y el resto de los campos 'Suma'
Perdona, a todas estas expresiones les sobraba un )
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar