**stanislav merovic** created an [issue](https://nhibernate.jira.com/browse/NH-2926) — <time datetime="2011-11-02T06:42:53.279Z" title="2011-11-02T06:42:53.279Z">2nd November 2011, 6:42:53</time>: > When trying to add a order for a composite-id using criteria queries the alias is removed only for the last property and a invalid query is created. > > Cause: Order.ToSqlString -> NHibernate.Util.StringHelper.RemoveAsAliasesFromSql(produced); -> sql.Substring(0, sql.LastIndexOfCaseInsensitive(" as ")); > > > --- **stanislav merovic** added a comment — <time datetime="2011-11-02T07:08:28.882Z" title="2011-11-02T07:08:28.882Z">2nd November 2011, 7:08:28</time>: > Forgot to mention: This happens when using the identifier projection. > > crit.AddOrder(Order.Asc(Projections.Id)) >