Used db->getColumn instead of cycle