Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add sql solution to lc problem: No.1322 #1815

Merged
merged 3 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: format
  • Loading branch information
thinkasany committed Oct 16, 2023
commit f6da5e7074d2edfd50052fb2644d0a00f6b43a40
10 changes: 3 additions & 7 deletions solution/1300-1399/1322.Ads Performance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,9 @@ Ads 表:
### **SQL**

```sql
SELECT ad_id,
ROUND(
IFNULL(
SUM(action='Clicked') / SUM(action IN ('Clicked', 'Viewed')) * 100
, 0)
, 2)
AS ctr
SELECT
ad_id,
ROUND(IFNULL(SUM(action = 'Clicked') / SUM(action IN ('Clicked', 'Viewed')) * 100, 0), 2) AS ctr
FROM Ads
GROUP BY 1
ORDER BY 2 DESC, 1;
Expand Down
10 changes: 3 additions & 7 deletions solution/1300-1399/1322.Ads Performance/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,9 @@ Note that we do not care about Ignored Ads.
### **SQL**

```sql
SELECT ad_id,
ROUND(
IFNULL(
SUM(action='Clicked') / SUM(action IN ('Clicked', 'Viewed')) * 100
, 0)
, 2)
AS ctr
SELECT
ad_id,
ROUND(IFNULL(SUM(action = 'Clicked') / SUM(action IN ('Clicked', 'Viewed')) * 100, 0), 2) AS ctr
FROM Ads
GROUP BY 1
ORDER BY 2 DESC, 1;
Expand Down