Hi,
I want to select first 10 distinct values from the table.
If I try
SELECT TOP 10 distinct target
FROM myTable
ORDER by target
then SQL Server gives error:
"Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'distinct'."
What's wrong with this statement? I know workaround using subqueries, but is there a way to do it without subqueries?
Thanks,
Alex
I want to select first 10 distinct values from the table.
If I try
SELECT TOP 10 distinct target
FROM myTable
ORDER by target
then SQL Server gives error:
"Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'distinct'."
What's wrong with this statement? I know workaround using subqueries, but is there a way to do it without subqueries?
Thanks,
Alex