diff -ru nodehierarchy/nodehierarchy.module new/nodehierarchy.module
--- nodehierarchy/nodehierarchy.module	2011-04-18 18:33:19.000000000 -0400
+++ new/nodehierarchy.module	2011-11-02 12:05:54.889105000 -0400
@@ -1593,7 +1593,7 @@
   $result = $items = $mlids = array();
   if ($types) {
     $result = db_query(
-                        "SELECT n.nid, n.type as type, n.title as title, n.uid as uid, ml.*, IF(depth IS NULL, 1, depth) as depth, IF(ml.mlid IS NULL, CONCAT('nid:', n.nid), ml.mlid) as mlid, ml.mlid as linkid
+                        "SELECT n.nid, n.type as type, n.title as title, n.uid as uid, ml.*, CASE WHEN depth IS NULL THEN 1 ELSE depth END as depth, CASE WHEN ml.mlid IS NULL THEN CONCAT('nid:', n.nid) ELSE CAST(ml.mlid AS VARCHAR(32)) END as mlid, ml.mlid as linkid
                            FROM {node} n
                       LEFT JOIN {nodehierarchy_menu_links} nh_parent
                              ON nh_parent.nid = n.nid
@@ -1601,7 +1601,7 @@
                              ON ml.mlid = nh_parent.mlid
                           WHERE (ml.module = 'nodehierarchy' OR ml.module IS NULL)
                             AND n.type IN (" . implode(', ', $types) . ")
-                          ORDER BY IF(p1 IS NULL, n.created, 0) ASC, p1 ASC, p2 ASC, p3 ASC, p4 ASC, p5 ASC, p6 ASC, p7 ASC, p8 ASC, p9 ASC",
+                          ORDER BY CASE WHEN p1 IS NULL THEN n.created ELSE 0 END ASC, p1 ASC, p2 ASC, p3 ASC, p4 ASC, p5 ASC, p6 ASC, p7 ASC, p8 ASC, p9 ASC",
                         array(),
                         array('fetch' => PDO::FETCH_ASSOC)
                     );
