Have you timed joining from a table already spelling out DISTINCT CONVERT(CHAR(4),YEAR(Invoice.ModDate)) ? Would need fitting index in invoice and perhaps a having clause to prune empty rows...
HTH
thomas
>I have a select like this:
>
>
>DECLARE @Success Bit
>
>SET @Success=1
>
>SELECT CONVERT(CHAR(4),YEAR(Invoice.ModDate)) AS lcChampNumero,COUNT(*) AS Compte,MIN(Invoice.ModDate) AS AddDate
> FROM Invoice (NOLOCK)
> INNER JOIN InvoiceStatus ON Invoice.NoInvoiceStatus=InvoiceStatus.Numero
> INNER JOIN Client ON Invoice.NoClient=Client.Numero
> WHERE (Invoice.Success=@Success) AND Invoice.NoSomething=2
> GROUP BY CONVERT(CHAR(4),YEAR(Invoice.ModDate))
> ORDER BY 1 DESC
>
>
>I am looking at an alternative to boost up performance here. In some occasions, this can be very long. There are indexes on every fields. However, this GROUP BY thing on a big table may take up to 10 to 50 seconds sometimes.