PDA

View Full Version : Query



waqas
06-14-2012, 11:30 AM
dear all i have a table with information of leaves and working hrs. i want to get info of those employees who worked after their last leave date.

for that i wrote a query which get last leave date.
query as below.

SELECT TblTimeSheetTest.IDNUM, TblTimeSheetTest.Designation, TblTimeSheetTest.TandA, Max(TblTimeSheetTest.SDay) AS LastDay
FROM TblTimeSheetTest
GROUP BY TblTimeSheetTest.IDNUM, TblTimeSheetTest.Designation, TblTimeSheetTest.TandA
HAVING (((TblTimeSheetTest.TandA) In ("Annual Leave","Emergency Leave")) AND ((Max(TblTimeSheetTest.SDay)) Between DateFrom() And (dateto()-3)))
ORDER BY TblTimeSheetTest.TandA, Max(TblTimeSheetTest.SDay);

now i want to get working hrs from this last date between next given date.

will it in same query with sub query or any other solution? kindly advise.:yes

waqas
06-30-2012, 06:31 AM
thanks.

how to write sub query as my knowledge we have to write sub query which return on field as result.

but in my criteria i need id number and date.

than how to write sub query with result of two fields in Criteria.