I need help with a Query,
I want to put the maximum value of id in the grouped table and show that id in result
I have this:
SELECT SUM(T1.quantity1),SUM(T1.quantity2),T1.RESOURCEID,T1.DOCUMENTCOSTDATE,
from TB_REPORTCOSTS T1, TB_EMPLOYEE
where T1.DOCUMENTNUMBER='123VGH123'
and T1.RESOURCEID=TB_EMPLOYEE.ID
GROUP BY T1.RESOURCEID, T1.DOCUMENTCOSTDATE
Grouped by employee and date but I need the row identifier
I Want this
SUM1 | SUM2 | ResourceID | DOCDate | ID |
---|
3 | 123 | 1 | 01/01/2016 | 2 |
43 | 32 | 1 | 01/02/2016 | 3 |
24 | 53 | 2 | 01/01/2016 | 5 |
234 | 32 | 3 | 01/02/2016 | 6 |
From this:
quantity1 | quantity2 | ResourceID | DOCDate | ID |
---|
1 | 100 | 1 | 01/01/2016 | 1 |
2 | 23 | 1 | 01/01/2016 | 2 |
43 | 32 | 1 | 01/02/2016 | 3 |
12 | 53 | 2 | 01/01/2016 | 4 |
12 | 0 | 2 | 01/01/2016 | 5 |
234 | 32 | 3 | 01/01/2016 | 6 |
Thanks you for your time!