| |

VerySource

 Forgot password?
 Register
Search
View: 747|Reply: 2

Ask a simple sql statement question: how can you find out the repeated pieces of data in a table! Thank you

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 Unknown

Post time: 2020-11-30 21:30:01
| Show all posts |Read mode
For example: the data in the table is 1 1 2 3 3 3
The results displayed after the query are: 1 1 3 3 3
Thank you
Reply

Use magic Report

0

Threads

110

Posts

63.00

Credits

Newbie

Rank: 1

Credits
63.00

 China

Post time: 2020-12-1 02:30:01
| Show all posts
for example:

select * from test where id in (select * from test group by id having (count(id)>1));
Reply

Use magic Report

0

Threads

110

Posts

63.00

Credits

Newbie

Rank: 1

Credits
63.00

 China

Post time: 2020-12-1 07:15:01
| Show all posts
test:


create table test(id int)

insert into test values(1)
insert into test values(1)
insert into test values(2)
insert into test values(3)
insert into test values(3)
insert into test values(3)

select * from test where id in (select * from test group by id having (count(id)>1));
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list