0
I have the following appointment:
SELECT
DATEDIFF(hh, MIN(BATIDA), MAX(BATIDA))AS HORAS
FROM ARELBATIDATRANSITOVIEW
WHERE CHAPA = 3187
AND BATIDA IS NOT NULL
AND SEQUENCIALBATIDA IN (2,3)
GROUP BY DATA
ORDER BY DATA DESC
Example:
HORAS
2
2
2
1
2
2
2
3
Only that it only returns me the hours,I need the other fields that would be:
SELECT
DATA,
CHAPA,
CODCOLIGADA,
BATIDA,
STATUS,
NATUREZA,
SEQUENCIALBATIDA,
DATEDIFF(hh, MIN(BATIDA), MAX(BATIDA))AS HORAS
FROM ARELBATIDATRANSITOVIEW
WHERE CHAPA = 3187
AND BATIDA IS NOT NULL
AND SEQUENCIALBATIDA IN (2,3)
GROUP BY DATA,CHAPA,CODCOLIGADA,BATIDA,STATUS,NATUREZA,SEQUENCIALBATIDA
ORDER BY DATA DESC
More when I run this query with all fields the field: DATEDIFF(hh, MIN(BATIDA), MAX(BATIDA))AS HORAS
returns with 0
Example:
HORAS
2016-10-17 00:00:00.000 123 1 2016-10-17 12:10:00.000 C 1 2 0
2016-10-17 00:00:00.000 123 1 2016-10-17 14:20:00.000 C 0 3 0
2016-10-14 00:00:00.000 123 1 2016-10-14 11:48:00.000 C 1 2 0
What could be ?
What my interest in this field hour,listar resultados > 2
I got it and it worked, Thank you.
– Chefe Druida