order by weight ASC - D7 This piece of code:

-&gt;orderBy('weight', 'ASC');


orders the column by the weight ascending. However, the rows are sorted like: 15 - 2 - 20
of course this should be: 2 - 15 - 20

How can I achieve this, specifically for drupal(7)?
It seems that the database is using lexicographic ordering, while your intention is to use numeric ordering. Numeric ordering is only used when the type of the field is a numeric type. Check whether the field is of a numeric type.