SELECT [ASOCIADOS DENSO].ID AS [NUMERO DE EMPLEADO], (SELECT COUNT([ID])FROM[FALTAS GENERALES] WHERE [ASOCIADOS DENSO].[ID]=[FALTAS GENERALES].[ID] and [FALTAS GENERALES].[FECHA]>(NOW()-365) and ( [faltas generales].[incon]=" 150 FALTA INJUSTIFICADA" or [faltas generales].[incon]=" 180 FALTA INJUSTIFICADA VALIDADA")) AS [Faltas Injustificadas], [ASOCIADOS DENSO].NOMBRE, [ASOCIADOS DENSO].ING, [Bajas Denso].BAJA, (([BAJA]-[ING])/30) AS Antiguedad
FROM [Faltas Generales], [ASOCIADOS DENSO] INNER JOIN [Bajas Denso] ON ([ASOCIADOS DENSO].ID = [Bajas Denso].ID) AND ([ASOCIADOS DENSO].ID = [Bajas Denso].ID)
GROUP BY [ASOCIADOS DENSO].ID, [ASOCIADOS DENSO].NOMBRE, [ASOCIADOS DENSO].ING, [Bajas Denso].BAJA, (([BAJA]-[ING])/30)
HAVING ((([Bajas Denso].BAJA) Between [Rango Inicio Fecha de Baja] And [Rango Final Fecha de baja]));
I have three tables, asociados denso, bajas denso and faltas generales, the problem with third table is that some employees will have not records on it, and if i have only, I cant display the records with values in the table 1 and 2 and with no records on the table #3, in other words i want to display records from tables 1, 2 even there is not records on table #3.
When i try to count the total of records resulted of this query, just to print in the report footer section, is not possible, because i need to put the two queries in one query or find another way to know how many records has a query to print in the report.
Hope this is clear!, Thanks in advance for your help
FROM [Faltas Generales], [ASOCIADOS DENSO] INNER JOIN [Bajas Denso] ON ([ASOCIADOS DENSO].ID = [Bajas Denso].ID) AND ([ASOCIADOS DENSO].ID = [Bajas Denso].ID)
GROUP BY [ASOCIADOS DENSO].ID, [ASOCIADOS DENSO].NOMBRE, [ASOCIADOS DENSO].ING, [Bajas Denso].BAJA, (([BAJA]-[ING])/30)
HAVING ((([Bajas Denso].BAJA) Between [Rango Inicio Fecha de Baja] And [Rango Final Fecha de baja]));
I have three tables, asociados denso, bajas denso and faltas generales, the problem with third table is that some employees will have not records on it, and if i have only, I cant display the records with values in the table 1 and 2 and with no records on the table #3, in other words i want to display records from tables 1, 2 even there is not records on table #3.
When i try to count the total of records resulted of this query, just to print in the report footer section, is not possible, because i need to put the two queries in one query or find another way to know how many records has a query to print in the report.
Hope this is clear!, Thanks in advance for your help