Skip to content

Commit 9942d9d

Browse files
committed
Time: 609 ms (44.42%) | Memory: 0B (100.00%) - LeetSync
1 parent 97f42e9 commit 9942d9d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Write your MySQL query statement below
2+
SELECT
3+
ROUND(100*SUM(CASE WHEN order_date = customer_pref_delivery_date THEN 1
4+
ELSE 0 END)/ COUNT(distinct customer_id) ,2) AS immediate_percentage
5+
FROM
6+
Delivery
7+
WHERE
8+
(customer_id, order_date)
9+
IN
10+
(SELECT
11+
customer_id, min(order_date) as min_date
12+
FROM
13+
Delivery
14+
GROUP BY
15+
customer_id
16+
);

0 commit comments

Comments
 (0)