Batch update menu_order attribute alphabetically

Hopefully this helps someone else

Dont forget to change “your_post_parent_id_here” with the parent id of your choosing.

    global $wpdb;
    $wpdb->query( 'SELECT @i:=-1' );
    $result = $wpdb->query(
        "
        UPDATE wp_posts SET menu_order = ( @i:= @i+1 ) WHERE post_parent="your_post_parent_id_here" ORDER BY post_title;
        "
    );