October 22, 2024
Chicago 12, Melborne City, USA
SQL

HAVING COUNT (COLUMN_INTEGER) = 0 doesn't give any result, but the column do has a lot of 0


I’m working with the Kaggle dataset of Fitbit used for a Google data analysis certificate project,
and I’m trying to find how many days with 0 steps every user (id) has.

This is my query:

SELECT COUNT (totalsteps), id
FROM daily_activity_03_04
GROUP BY id
HAVING COUNT(totalsteps) =0;

The output is a table with no results.

id is a text and, totalsteps is an integer.

I don’t know what I’m doing wrong or how to fix it.

I used the CAST function to change the totalsteps column to integer, but It didn’t work. I have the same issue with the rest if integer columns.



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video