A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
video training course this week in the
JDBC and Relational Databases
Joined: Jun 25, 2009
Aug 04, 2009 13:18:32
I want to build a query by using the condition month and year of date not the day.
Here is my query;
select empname, empno, empdate, count(empdate) as count from emp_table where Month(empdate)=07 and year(empdate) =2009 group by empno
But the above query is very slow. Is there any other date format for month and year to make it faster.
Joined: Feb 23, 2009
Aug 04, 2009 13:27:06
I don't think an SQL based query belongs into the
If your empdate field is indexed, this key cannot be used if you use it with a function.
This way the key is usable
1. select empname, empno, empdate, count(empdate) as count from emp_table where empdate between '2009-07-01' and '2009-07-31' group by empno
An easy to use, light-weight JDBC framework
Author and ninkuma
Joined: Jan 10, 2002
Aug 04, 2009 13:41:03
Please take the time to choose the correct forum for your posts. This forum is for questions on JSP.
For more information, please
This post has been moved to a more appropriate forum.
Asking smart questions
Books by Bear
I agree. Here's the link:
subject: date format
invoke functions in a jpl query
request.getParameter retuning null
Problem with date validation
date operations in Hibernate
Retrieve value from a DateField
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015