Problems displaying zero in results - get 'No Results!' instead

When any of the fields that I am retrieving contains null results (see picture 2), I get <<No Results! This may be the answer you’re looking for. If not, try removing or changing your filters to make them less specific.>> as a result.

I have tried in different ways to transform the null results into values of zero, but unsuccessfully so. I have tried to use the 'COALESCE([field], 0)' and the 'IFNULL([field], 0)' functions, but they unfortunately do not affect the results (pics 3 and 4).
(These seemed to work for other people in other cases: here for the COALESCE function, and here for the IFNULL function).

I attach here a few screenshots that show the SQL code. These show when the code works, when the fields at issue do not contain null values (pic 1), and when the code does not work (pic 2), even with the use of the COALESCE and IFNULL functions (pics 3 and 4 respectively).

I know for sure that the results of the field that is causing trouble ('# of resource ratings') are values of zero. As they are not showing as zero values, I am assuming that they have NULL values instead, but this is just an assumption and I may be mistaken. Anyway, the problem remains!

Thank you in advance for your help, it is very much appreciated!

Hi @mattia
Post "Diagnostic Info" from Admin > Troubleshooting.
I don't know which database type you're querying, but guessing MySQL.
Your optional filter clauses are wrong. It should be:
[[AND date(...

Hi flamber,

Thanks for the quick response!

I am using MySQL, yes.

I fixed the AND clauses you correctly addressed but I still get the same results ('No Results! etc.').

I post here the diagnostic info as you asked:

{
"browser-info": {
"language": "en-US",
"platform": "Win32",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.82 Safari/537.36",
"vendor": "Google Inc."
},
"system-info": {
"file.encoding": "UTF-8",
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.11+9-Ubuntu-0ubuntu2.18.04",
"java.vendor": "Ubuntu",
"java.vendor.url": "https://ubuntu.com/",
"java.version": "11.0.11",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.11+9-Ubuntu-0ubuntu2.18.04",
"os.name": "Linux",
"os.version": "4.15.0-163-generic",
"user.language": "en",
"user.timezone": "Etc/UTC"
},
"metabase-info": {
"databases": [
"mysql",
"googleanalytics"
],
"hosting-env": "unknown",
"application-database": "h2",
"application-database-details": {
"database": {
"name": "H2",
"version": "1.4.197 (2018-03-18)"
},
"jdbc-driver": {
"name": "H2 JDBC Driver",
"version": "1.4.197 (2018-03-18)"
}
},
"run-mode": "prod",
"version": {
"date": "2021-10-21",
"tag": "v0.41.1",
"branch": "release-x.41.x",
"hash": "76aa4a5"
},
"settings": {
"report-timezone": "Etc/GMT+1"
}
}
}

@mattia You should upgrade immediately to a newer release:
https://github.com/metabase/metabase/releases/latest
And migrate away from H2 if you are using Metabase in production:
https://www.metabase.com/docs/latest/operations-guide/migrating-from-h2.html
I guess it is some quirk of MySQL:
https://stackoverflow.com/questions/1354060/mysql-count-and-nulls

Thank you again! I will upgrade to a newer release and see if the problems gets solved this way.

@mattia It will not be fixed by the upgrades, but security will be improved. See the stackoverflow question, since it seems like it's a quirks of MySQL and not anything specific to Metabase, then you can find better answers on forums specific to your database type.