| |

VerySource

 Forgot password?
 Register
Search
View: 9|Reply: 3

How to write this SQL?

[Copy link]

1

Threads

1

Posts

2

Credits

Newbie

Rank: 1

Credits
2

 China

Post time: 2020-1-10 12:20:01
| Show all posts |Read mode
There is a data sheet

A1 A2 mem
1001 11 Good
1001 211 Good 1
1002 SS bad
1002 DD bad
..

I want to display the first record with the same content in the A1 field
A1 A2 mem
1001 11 Good
1002 SS bad
Reply

Use magic Report

0

Threads

20

Posts

12

Credits

Newbie

Rank: 1

Credits
12

 China

Post time: 2020-1-17 23:09:01
| Show all posts
select A1, first (A2), first (mem)
from table name
group by A1
Reply

Use magic Report

0

Threads

11

Posts

10

Credits

Newbie

Rank: 1

Credits
10

 China

Post time: 2020-2-16 18:15:01
| Show all posts
It is best to add an auto-increment field and then write the SQL statement.
Reply

Use magic Report

0

Threads

5

Posts

3

Credits

Newbie

Rank: 1

Credits
3

 China

Post time: 2020-5-31 13:30:02
| Show all posts
select A1, first (A2), first (mem)
from table name
group by A1



-Agree with this
Reply

Use magic Report

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

Points Rules

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

Quick Reply To Top Return to the list