I have the following structure:
ID CID CAMPAIGN_ID DATE(DATETIME) DEVICE
1 123 88 2012-04-29 07:26:14 PC
2 123 88 2012-04-29 08:46:04 IPHONE
3 555 91 2012-04-29 08:36:04 IPAD
I’m trying to find a way to build a query that will return all the valid CIDs that first used the PC and then used the IPHONE (according to the date specified) under a specified campaign_id.
in the example above CID 123 falls into that category.
As @JohannBlais said in his comment, you need to join the table to itself on the desired criteria and then filter for your chosen campaign: