Skip to content

Commit ac5ac58

Browse files
committed
Section 02 : Basic Agg : part 03 - P7
1 parent 52254a2 commit ac5ac58

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
SELECT ROUND (
2+
AVG(
3+
CASE WHEN order_date = customer_pref_delivery_date THEN 1 ELSE 0 END
4+
) * 100 , 2) AS immediate_percentage
5+
FROM Delivery
6+
WHERE (customer_id, order_date) IN
7+
(
8+
SELECT customer_id, min(order_date)
9+
FROM Delivery
10+
GROUP BY customer_id
11+
)

0 commit comments

Comments
 (0)