SQL MAX function

  • Hi,

    I have been using the following SQL query and it has been working fine up until just recently (last couple of days)

    SELECT MIN(Sig_Version) AS Min_Sig, REPLACE(MIN(Sig_Version), '.', '') AS nMin_Sig, MAX(Sig_Version) AS Max_Sig, REPLACE(MAX(Sig_Version), '.', '') AS nMax_Sig,

    MIN(AV_Version) AS Min_Prod, REPLACE(MIN(AV_Version), '.', '') AS nMin_Prod, MAX(AV_Version) AS Max_Prod, REPLACE(MAX(AV_Version), '.', '') AS nMax_Prod,

    AV_Product

    FROM dbo.vwSWD_AV AS vsa

    GROUP BY AV_Product

    Min_SignMin_SigMax_SignMax_SigMin_ProdnMin_ProdMax_ProdnMax_ProdAV_Product

    0.0.0.00000N/AN/A8.1.637816378.1.65581655CA eTrustITM Agent

    36.1.0.83843610838436.1.0.8385361083858.1.637816378.1.63781637CA eTrustITM Remote Install

    N/AN/AN/AN/AN/AN/AN/AN/ANo Supported AV installed

    31.6.6482316648236.1.833136183317.1.01927101927.1.0192710192CA eTrust Antivirus

    N/AN/AN/AN/AN/AN/AN/AN/ANot Reported

    5400.1158540011585400.1158540011588.7.08708.8.000008800000McAfee VirusScan Enterprise

    Now for some reason the MAX value of CA etRustITM Agent shows as N/A when thre is actually a value, the only thing that I can see is that the Sig Version for both the CA eTrustITM Agent and the CA eTrustITM Remote Install are the same values in the database (36.1.0.8385)

    Any help would be greatly appreciated

    Regards..

    Peter

  • Is this the compete query , if there is no data to return sl return null not N/a , if N/A is the value your getting there is a data issue.

    Jayanth Kurup[/url]

  • Hi,

    Found the problem, there was actually a single 'N/A' in one row value and as MAX see this higher than any text based number it was showing it as the MAX for that grouping.

    I have resolved the issue for now.

    Regards..

    Peter

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply