Example usage - if a field is a varchar and you need to sort by a number. It will sort it alpabetically, instead of numerically. Type casting will convert it to an altenative data type.
SELECT * FROM table WHERE column = 'variable' ORDER BY CAST(id AS UNSIGNED INTEGER ) ASC
Does Drupal development make your head explode and drive you crazy?
Why not learn from someone who has paved the way instead?
Sign up to my upcoming learning series.
I am Blair Wadman and this is where I write about Drupal, PHP, CSS etc
© Blair Wadman
2005 - 2011
Post new comment