CASTING attributes for Ordering on a Doctrine2 DQL Query

后端 未结 7 445
一向
一向 2020-12-03 03:33

I am trying to get Doctrine2 Entities, ordered by their ID which apparently is a String even though it contains only Numbers. So what I would like to do is

相关标签:
7条回答
  • 2020-12-03 03:59

    Try this one by with out changing the data type

      select (entity1 * 1) as display_value, entity1 as return_value 
          from Table_Name
         order by 1 asc;
    
    0 讨论(0)
提交回复
热议问题