- Home
- Anonymous
- Sign in
- Create
- Ask a question
- Spaces
- Site Issues (NOT FOR DATABASE QUESTIONS)
- Explore
- Topics
- Questions
- Users
- Badges

Here's a hypothetical question Rule to determine Nike shoes buyer: 9 purchase days or less must have 100% Nike shoe purchases. At 10+ purchase days, if 95%or more purchase days are Nike, then buyer is a Nike buyer. Examples of Nike Buyer ---------------------- 1) Joe buys Nike shoes for 8 days. Only buys Nike. 2) Troy buys Nike shoes for 100 days. 95 of those days, he bought Nike shoes. Examples of **non**-Nike Buyer ------------------------------ 3) Bill buys Nike shoes for 7 days, but on two days, he also bought Adidas shoes. 4) John buys Nike shoes for 100 days. 94 of those days, he bought Nike shoes. Tables: ------- Nike Adidas Fields/Columns: --------------- UserID (both tables) date of purchase (both tables) Nike purchase amount Adidas purchase amount Is there any way of incorporating all of the above into a single query? When I try using a case statement, I can't seem to use formulas after "WHEN"

sql
Comment

**18** People are following this question.

Copyright 2022 Redgate Software.
Privacy Policy