Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Warning: Null value is eliminated by an aggregate or other SET operation.???

Posted on 2006-07-07
4
1,647 Views
Last Modified: 2008-01-09
Hi all

I have this query below when i run it gives a message:
Warning: Null value is eliminated by an aggregate or other SET operation.

How do I solve that warning?

Please kindly assist, thanks

SELECT
R1.JobNumber,
R1.JobName,
R1.ProjectManagerNumber,
CASE WHEN R1.LastTimeReg = '1900.01.01' THEN 'N/A' ELSE R1.LastTimeReg END AS LastTimeReg,
CASE WHEN R1.LastExpenseReg = '1900.01.01' THEN 'N/A' ELSE R1.LastExpenseReg END AS LastExpenseReg,
CASE WHEN R1.LastPOReg = '1900.01.01' THEN 'N/A' ELSE R1.LastPOReg END  AS LastPOReg

FROM
(SELECT
JH.JobNumber,
JH.JobName,
JH.ProjectManagerNumber,
ISNULL(MAX(TSL.PeriodStart), '1900.01.01') AS LastTimeReg,
ISNULL(MAX(ESL.DateOfEntry), '1900.01.01') AS LastExpenseReg,
ISNULL(MAX(RH.CreatedDate), '1900.01.01') AS LastPOReg

FROM
JobHeader JH LEFT OUTER JOIN TimeSheetLine TSL ON JH.JobNumber = TSL.JobNumber
LEFT OUTER JOIN ExpenseSheetLine ESL ON JH.JobNumber = ESL.JobNumber
LEFT OUTER JOIN RequisitionHeader RH ON JH.JobNumber = RH.JobNumber
WHERE
(JH.IsBlocked = 0 AND JH.BlockedForInvoicing = 0 AND JH.Closed = 0 AND JH.Template = 0)
GROUP BY
JH.JobNumber,
JH.JobName,
JH.ProjectManagerNumber
) AS R1

WHERE
R1.ProjectManagerNumber  = '300020'
AND (R1.LastTimeReg != '1900.01.01' OR R1.LastExpenseReg != '1900.01.01' OR R1.LastPOReg != '1900.01.01')
AND ((DateDiff(Day, R1.LastTimeReg, GetDate()) >= 28) AND (DateDiff(Day,R1.LastExpenseReg, GetDate()) >= 28) AND (DateDiff(Day, R1.LastPOReg, GetDate()) >= 28))
0
Comment
Question by:minichicken
4 Comments
 
LVL 25

Accepted Solution

by:
Mr_Peerapol earned 500 total points
ID: 17058329
I guess that some records might have NULL values in TSL.PeriodStart, ESL.DateOfEntry, RH.CreatedDate.

You can do like this:

ISNULL(MAX(ISNULL(TSL.PeriodStart, '1900.01.01')), '1900.01.01') AS LastTimeReg,
ISNULL(MAX(ISNULL(ESL.DateOfEntry, '1900.01.01')), '1900.01.01') AS LastExpenseReg,
ISNULL(MAX(ISNULL(RH.CreatedDate, '1900.01.01')), '1900.01.01') AS LastPOReg
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17058331
0
 
LVL 23

Expert Comment

by:Racim BOUDJAKDJI
ID: 17058434
Get rid of NULL values on your database.  Simplest and long lasting effect solution.
0
 
LVL 12

Author Comment

by:minichicken
ID: 17058452
Perfect Mr_Peerapol, you the best!!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how the fundamental information of how to create a table.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question