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

How to use where with between clause

 
Jeetendra S Ahuja
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic