Avatar of Abdul Khan
Abdul Khan
 asked on

SQL Query

Need help with a SQL query where I am able to:
Select an account number, ProdID, and TrDate when ProdID 5612 sold twice within 24 hours after ProdID 2808 is sold.


Acct#            ProdID                  TrDate
123            2808                  2017-10-09 11:42:00.000
123            5612                  2017-10-09 11:50:00.000
123            5612                  2017-10-10 11:42:00.000
123            2808                  2017-10-11 11:42:00.000
123            5612                  2017-10-11 13:42:00.000
123            5612                  2017-10-11 14:42:00.000
123            5612                  2017-10-15 11:42:00.000
SQL

Avatar of undefined
Last Comment
Abdul Khan

8/22/2022 - Mon
Pawan Kumar

What will the output from the input you have given,
Abdul Khan

ASKER
print the AcctNumber, ProdID, and Trdate only when the product 5612 sold twice within 24 Hours.
The goal is to find out that how many of the 2808 sold when 5612 sold within 24 hours:

123            2808                  2017-10-11 11:42:00.000
123            5612                  2017-10-11 13:42:00.000
123            5612                  2017-10-11 14:42:00.000
ASKER CERTIFIED SOLUTION
Pawan Kumar

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Abdul Khan

ASKER
Thanks so much Pawan!
Your help has saved me hundreds of hours of internet surfing.
fblack61
Pawan Kumar

welcome. Happy to help.
Abdul Khan

ASKER
Thanks Pawan!