• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

UnExpected output while executing a query

 
Ranch Hand
Posts: 43
Notepad Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I am performing a mysql query on database. I am  getting a very unexpected result. Here is what query looks like.



and here is the table : http://prnt.sc/chmss6

I am getting output as 3900 though there is no cell "Shipment" and should have returned 0 as output. Please help!

 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Either you're running a different query than that, or the query is reading from a different table than that.
 
tushar attar
Ranch Hand
Posts: 43
Notepad Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is the exact query I am running wrt the table above.
 
tushar attar
Ranch Hand
Posts: 43
Notepad Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just hit and tried that no matter what i type in type="" , it always returns 3900 as if type="" is not even considered.
 
tushar attar
Ranch Hand
Posts: 43
Notepad Chrome Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have resolved the issue, it was silly mistake from my end, query should have been

SELECT SUM(amount) FROM expenses WHERE type = "Shipment" AND date BETWEEN '2016-1-1' AND '2016-9-13';
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic