File tree 6 files changed +25
-8
lines changed
0196.Delete Duplicate Emails
6 files changed +25
-8
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ Id 是这个表的主键。
46
46
### ** SQL**
47
47
48
48
```
49
-
49
+ delete from Person where Id not in (select min(Id) from (select * from Person) as p group by p.Email)
50
50
```
51
51
52
- <!-- tabs:end -->
52
+ <!-- tabs:end -->
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ Id is the primary key column for this table.
68
68
### ** SQL**
69
69
70
70
```
71
-
71
+ delete from Person where Id not in (select min(Id) from (select * from Person) as p group by p.Email)
72
72
```
73
73
74
- <!-- tabs:end -->
74
+ <!-- tabs:end -->
Original file line number Diff line number Diff line change
1
+ delete from Person where Id not in (select min (Id) from (select * from Person) as p group by p .Email )
Original file line number Diff line number Diff line change 35
35
### ** SQL**
36
36
37
37
```
38
-
38
+ select w1.Id
39
+ from
40
+ Weather w1,
41
+ Weather w2
42
+ where
43
+ DATEDIFF(w1.RecordDate, w2.RecordDate) = 1 and w1.Temperature > w2.Temperature
39
44
```
40
45
41
- <!-- tabs:end -->
46
+ <!-- tabs:end -->
Original file line number Diff line number Diff line change 60
60
### ** SQL**
61
61
62
62
```
63
-
63
+ select w1.Id
64
+ from
65
+ Weather w1,
66
+ Weather w2
67
+ where
68
+ DATEDIFF(w1.RecordDate, w2.RecordDate) = 1 and w1.Temperature > w2.Temperature
64
69
```
65
70
66
- <!-- tabs:end -->
71
+ <!-- tabs:end -->
Original file line number Diff line number Diff line change
1
+ select w1 .Id
2
+ from
3
+ Weather w1,
4
+ Weather w2
5
+ where
6
+ DATEDIFF(w1 .RecordDate , w2 .RecordDate ) = 1 and w1 .Temperature > w2 .Temperature
You can’t perform that action at this time.
0 commit comments