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) A socialist is someone who will give you the shirt off *someone else's* back.