Solved

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

Posted on 2006-07-07
4
1,643 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 142

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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

Suggested Solutions

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now