Home Forums SQL Server 2008 T-SQL (SS2K8) find a grouping with at least one row within the group containing a certain value RE: find a grouping with at least one row within the group containing a certain value

  • For this,

    SELECT retailer_name, blood_type, blood_price,

    COUNT(*) OVER (PARTITION BY retailer_name)

    AS inventory_cnt

    FROM Vampire_Retailers AS VR

    WHERE blood_type = 'B';

    Wouldn't you instead get nameA, 'B', 2.75, 1 and not nameA, 'B', 2.75, 2 due to the where clause?