• Post Reply Bookmark Topic Watch Topic
  • New Topic

UnExpected output while executing a query

 
tushar attar
Ranch Hand
Posts: 38
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: 21963
36
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: 38
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: 38
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: 38
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';
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!