• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

UnExpected output while executing a query

 
Ranch Hand
Posts: 43
Notepad Chrome Java
  • 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!

 
Marshal
Posts: 25669
69
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: 43
Notepad Chrome Java
  • 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: 43
Notepad Chrome Java
  • 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: 43
Notepad Chrome Java
  • 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';
 
A sonic boom would certainly ruin a giant souffle. But this tiny ad would protect it:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic