In my project i display the pending status in week manner.i wrote a below sql query for that
SELECT count(Distinct(DATEPART(wk,spentDate))) FROM [tblTimesheet] where TimesheetStatus = 'Pending' and Approver = 6
How to write the equivalent criteria or hql for the above query.
Any help will be greatly appreciated!
Try this: How to query on a month for a date with Hibernate criteria, was useful for me!
Maybe you need http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html to understand how to use the equivalents of MSSQL DATEPART in MySQL