There are a few ways to eliminate null values when grouping data in DB2:
SELECT COALESCE(column_name, 'default_value') AS new_column_name, COUNT(*)
FROM table_name
GROUP BY new_column_name;
SELECT column_name, COUNT(*)
FROM table_name
WHERE column_name IS NOT NULL
GROUP BY column_name;
SELECT column_name, COUNT(*)
FROM table_name
GROUP BY column_name
HAVING column_name IS NOT NULL;
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2021-09-04 11:00:00 +0000
Seen: 8 times
Last updated: Jul 06 '22
Is it possible to launch multiple instances of PostgreSQL using Spring Boot Testcontainers?
What does the DB2 Trigger do following an insertion?
How can I link to two distinct MongoDB databases in my Nuxt 3/ Vue 3 application?
What does @mock_dynamodb2 do with table context?
How can I change the database connection within an interceptor in NestJS using Sequelize-Typescript?
What is the driver for DB2 that uses the R2DBC protocol?
How can SQLAlchemy be used to establish a connection with an IBM DB2 database?