Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1368
  • Last Modified:

NULL Value eliminated in aggregate function

Hi Experts!
I was hoping someone could be abel to assist me with an SQL query for my Sybase database.

The query below gives me the warning
NULL Value eliminated in aggregate function

It seams like the query gives me correct result, but I cannot live with the warning
select
count(case when Programs.Level=1 then 1 else NULL end) as Level1,
count(case when Programs.Level=2 then 1 else NULL end) as Level2
from Programs key join Customers key join ProgramHead
*
*
*

Open in new window

0
gfk76
Asked:
gfk76
1 Solution
 
Jan FranekCommented:
Try this modified version (using sum instead of count)
select
sum(case when Programs.Level=1 then 1 else 0 end) as Level1,
sum(case when Programs.Level=2 then 1 else 0 end) as Level2
from Programs key join Customers key join ProgramHead

Open in new window

0
 
gfk76Author Commented:
Ahhh.....

Thank you very much!

That did the trick
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now