Solved

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

Posted on 2006-07-07
4
1,650 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
[X]
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
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 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

726 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