Link to home
Create AccountLog in
Avatar of indy500fan
indy500fan

asked on

need help with a qry, Dealing with a Null Value, again...

Friends,

I have the following qry:

select AVG(Laptime) as AverageGreenLapTime
from
(
Select LapTime From Passings Where
RunID=@RunID
and LapTime > -1
and FlagState=1
And PassingTime IN (SELECT Top 10 MIN(PassingTime)
FROM Passings
WHERE
LapCount=LeaderLap AND
DecoderID=(Select DecoderID From Timelines Where IsLapCounter=1 and IsInPit=0) AND
Deleted=0 AND
RunID=@RunID
And FlagState=1
GROUP BY
LeaderLap
Order By LeaderLap DESC)
) Green

Now, when I run it, as long as there are green laps, it works okay.  However, if no green laps exist, then I get a returned value of NULL.

How, do I return a value of 0 instead if the value is NULL?

REgards,
Eric

No
ASKER CERTIFIED SOLUTION
Avatar of chapmandew
chapmandew
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of indy500fan
indy500fan

ASKER

chapmandew,

Thanks again!  I'm starting to learn a lot about this!

Regards,
Eric
Great...thats what we're here for.