Home Forums SQL Server 2008 T-SQL (SS2K8) Get multiple rows of data based on one condition and grouping RE: Get multiple rows of data based on one condition and grouping

  • SELECT *

    FROM dbo.CustomerPurchase cp

    WHERE

    cp.PurchaseDate = '20120601 00:00:00.000' AND

    EXISTS(

    SELECT 1

    FROM dbo.CustomerPurchase cp2

    WHERE

    cp2.CustomerId = cp.CustomerId AND

    cp2.PurchaseDate = '20120601 00:00:00.000' AND

    cp2.PurchaseDetails = 'Loyalty Customers'

    )

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".