Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in query

 
Ram Mohan
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai friends
i have a problem while executing the query below



if the difference btwn two dates is more than 15 the result is not correct
Is this because of the problem in the query?

Help me......

if you are having another query which is more apt please give it to me

Ram Mohan
 
deepthi k
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just try out
select * from (tablename) where date1 <='date' and date2 >='date' and ....
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There doesn't look to be anything wrong with the query (presuming you know date1 is always earlier than date2?).

What makes you think the number 15 is significant? And 15 of what - milliseconds, hours, centuries?
 
Ram Mohan
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using this query in a jsp page,inorder to view the contents of some category during some period.

I am geting resultset for last 10,20 days.
But resultset is null for last 15,30 and >30 days.

how it happens

Ram Mohan
 
stu derby
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ram Mohan:

I am geting resultset for last 10,20 days.
But resultset is null for last 15,30 and >30 days.


There's nothing wrong with the SQL; the problem probably has something to do with data types and type conversions. That would depend on the table definition in the database and the Java code.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic