Fixing a SQL error in inventory dashboard