• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

problem in query

 
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
 
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 ....
 
Bartender
Posts: 10336
Hibernate Eclipse IDE 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
 
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.
 
She said she got a brazillian. I think owning people is wrong. That is how I learned ... tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!