• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

UnExpected output while executing a query

 
tushar attar
Ranch Hand
Posts: 36
Chrome Java Notepad
  • Mark post as helpful
  • send pies
  • 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!

 
Paul Clapham
Sheriff
Posts: 21554
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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: 36
Chrome Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the exact query I am running wrt the table above.
 
tushar attar
Ranch Hand
Posts: 36
Chrome Java Notepad
  • Mark post as helpful
  • send pies
  • 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: 36
Chrome Java Notepad
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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';
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic