Can not use Distinct with sorting, conversion and alias.The error occurs:"Msg 145, Level 15, State 1, Line 1ORDER BY items must appear in the select list if SELECT DISTINCT is specified."This command works: "Select Distinct Top 10 CdChamada = Convert(Bigint, CdChamada) From Pessoa Order by CdChamada"This command, with alias, does not work: "Select Distinct Top 10 CdChamada = Convert(Bigint, P.CdChamada) From Pessoa P Order by P.CdChamada"
Product Language
Version
Category
Operating System
Operating System Language
Steps to Reproduce
Actual Results
Expected Results
Platform
Virtualization