1

Im trying to add an extra AND statement to my SQL query. I work fine as:

SELECT * FROM tsv WHERE YEAR(`Reporting Date`) = 2017 AND MONTH(`Reporting Date`) = 6

But when I try to add the extra line (AND ISRC = QZERG1727327) in the end it dosen´t work any more

SELECT * FROM tsv WHERE YEAR(`Reporting Date`) = 2017 AND MONTH(`Reporting Date`) = 6 AND ISRC = QZERG1727327

It´s hard to find any solutions online, I really don´t know what to do.

Jonas Borneland
  • 383
  • 1
  • 6
  • 19

1 Answers1

4

Strings in SQL have to be enclosed in single quotes, so your query should be

SELECT * FROM tsv 
WHERE YEAR(`Reporting Date`)=2017 AND MONTH(`Reporting Date`)=6 
  AND ISRC='QZERG1727327'
Karsten Koop
  • 2,475
  • 1
  • 18
  • 23