static function fetchCountByCategory( $categories )
    {
        $db = eZDB::instance();

        $query = "SELECT COUNT(*) AS count FROM ezvatrule vr, ezvatrule_product_category vrpc " .
                 "WHERE vr.id=vrpc.vatrule_id AND ";

        if ( is_array( $categories ) )
        {
            $query .= $db->generateSQLINStatement( $categories, 'vrpc.product_category_id', false, false, 'int' );
        }
        else
        {
            $query .= "vrpc.product_category_id =" . (int) $categories;
        }

        $rows = $db->arrayQuery( $query );

        return $rows[0]['count'];
    }