tsql - Order Sql Request with top Percent -


i have exception when execute query think created, error : msg 102, niveau 15, État 1, ligne 6 syntaxe incorrecte vers ')'. here request :

 select distinct designation    (select top 100 percent designation , code_piececomptable   cpt_lignepiececomptable    code_piececomptable in    (select code_piececomptable    cpt_piececomptable    terminer  null or terminer <>1)    order code_piececomptable) 

you need give alias:

 select distinct designation    (select top 100 percent designation , code_piececomptable   cpt_lignepiececomptable    code_piececomptable in    (select code_piececomptable    cpt_piececomptable    terminer  null or terminer <>1)    order code_piececomptable) q 

take note q tacked on end.


Comments

Popular posts from this blog

How to logout from a login page in asp.net -

Stack level too deep error after upgrade to rails 3.2 and ruby 1.9.3 -