Home > database >  Consult a query string
Consult a query string

Time:03-22

Database has a field in the period of character types, the field name "jdyf", the internal data is as follows:
2020-1
2020-2
2020-3
2020-4
2020-5
2020-6
2020-7
The 2020-8
2020-9
The 2020-10
The 2020-11
2020-12
2021-1
2021-2
2021-3
I want to query data between 2020-11 to 2021-2
SELECT jdyf SFCLSBMC, SFHSDJ JDBM, jiandingshu=SUM (CASE WHEN JDFS='inspection' AND JCJL IN (' HG ', 'BH) THEN SFSL ELSE 0 END) FROM JDJZJH WHERE (jdyf & gt;='2020-11) AND (JDFS=' were ') AND (jdyf & lt;='2021-2) GROUP BY jdyf, SFCLSBMC, SFHSDJ, JDBM ORDER BY jdyf, SFCLSBMC, SFHSDJ, JDBM
But this query result is: 2020-1202 0 0 0 0-2202-3202-4202-5202 0 0-6202-7202 0 0 0 0-8202-9202-11202-12202-1-1202-1-2202-1-3, is not what I want, how to change? thank you
  • Related