wood burning stoves 2.0*
The moose likes JDBC and the fly likes How to use where with between clause Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to use where with between clause" Watch "How to use where with between clause" New topic
Author

How to use where with between clause

Jeetendra S Ahuja
Greenhorn

Joined: Feb 11, 2012
Posts: 7
select SUM(fuel_bus) from fuel between date="2011-03-12" and date="2011-0
3-15" where busno=2;//
Above mentioned is query for which i am getting mysql syntax error
Description:
fuel_bus=column name that stores float fuel qty values(say 18.6)
fuel=DB name
date=column name, that specifies date on which fuel entry is done
busno=busno for which date wise fuel qty. is feeded
NOw what i want is to calculate fuel qty. from desired date to desired date with respect to specific busno.
select busno,SUM(fuel_bus) from fuel where busno=2;,this query is running,how to integrate between clause with it...
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3606
    
  60

Try to google up MySQL between syntax. One of the top links leads to MySQL documentation with all proper details of its use. To help you get faster on track: the BETWEEN keyword is part of an expression which must go into the WHERE clause and can be combined with other conditions using usual boolean operators, such as AND and OR.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use where with between clause
 
Similar Threads
Retrieve values from radio buttons
how to convert gregoriancalendar obj to sqldate?
the between clause
sql query involving dynamic date
Error ORA-00937