Hi,

I'm using SQL Server 2005 and I'm having a bit of trouble with something that seems like it should be pretty simple.

I have a table with 2 fields - AccountNo and Name. Neither field has to be unique.

I want to get the number of distinct AccountNo where the Name begins with the letter a.

Code:
SELECT DISTINCT(AccountNo) FROM (SELECT AccountNo FROM Customers WHERE Name LIKE 'a%')
The query fails and I get the message "Incorrect syntax near ')".

I'm sure I'm doing something pretty stupid somewhere. Can anyone help me figure out what it it?

Thanks,

dlarkin77