• Couple ways to do it. First, you could just add an "alias" to the query you already have. Do that by typing a name for it after the last close-parentheses.

    select count(*)

    from

    (

    SELECT distinct year(cumdate) from dbo.EX1_FACT_SO

    where year(cumdate) in (year(getdate()),year(getdate())-1)

    ) AliasName

    Another way would be to eliminate the outer query:

    SELECT count(distinct year(cumdate))

    from dbo.EX1_FACT_SO

    where year(cumdate) in (year(getdate()),year(getdate())-1)

    Try both, see which one you like better.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon