Fix SQL error in categoriesdetailed print view