User810354248 posted
In my asp.net+VB=SQL web i have a query for dropdownlist
Dim comd2 As New SqlCommand("SELECT distinct EmpNo from Leave ORDER BY CAST(SUBSTRING(EMPNO + '0', PATINDEX('%[0-9]%', EMPNO + '0'), LEN(EMPNO + '0')) AS INT)", con2)
If I remove DISTINCT from the above query it works for me.
But want to pick DISTINCT EMPNO from table leave
Error is as under
ORDER BY items must appear in the select list if SELECT DISTINCT is specified.