Sort on an aggregate

I want to SELECT DISTINCT left(Contract,8) where Contract > "TJU" ORDER BY Contract;

I can't do the ORDER BY clause. How do I order by an aggregate like this?

[186 byte] By [JiminNoVA] at [2007-12-22]
# 1

Are you running this in Reporting Services? If so, the properties of the table should have a Sort tab that can be changed.

Also try adding Left(Contract,8) to the order by clause.

Andrew-T4G at 2007-8-30 > top of Msdn Tech,SQL Server,SQL Server Reporting Services...
# 2

It's actually the row source clause in a VBA combo box, but I checked and found it's actually a SQL rule, not a VB or VBA rule. It's not allowed in MySQL either. I did try the Left(Contract,8) syntax as well

JiminNoVA at 2007-8-30 > top of Msdn Tech,SQL Server,SQL Server Reporting Services...

SQL Server

Site Classified