8000 Update README.md · tcv-tclsbc/sql-50-leetcode@8160103 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8160103

Browse files
committed
Update README.md
1 parent bfeb3ab commit 8160103

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,4 +402,28 @@ WITH cte AS (
402402
SELECT DISTINCT(num) AS ConsecutiveNums
403403
FROM cte
404404
WHERE num = next AND num = prev
405+
```
406+
407+
408+
[1164. Product Price at a Given Date](https://leetcode.com/problems/product-price-at-a-given-date)
409+
```sql
410+
SELECT product_id, new_price AS price
411+
FROM products
412+
WHERE (product_id, change_date) IN
413+
(
414+
SELECT product_id, MAX(change_date)
415+
FROM products
416+
WHERE change_date <= '2019-08-16'
417+
GROUP BY product_id
418+
)
419+
UNION
420+
421+
SELECT product_id, 10 AS price
422+
FROM products
423+
WHEN product_id NOT IN
424+
(
425+
SELECT product_id
426+
FROM products
427+
WHERE change_date <= '2019-08-16'
428+
)
405429
```

0 commit comments

Comments
 (0)
0