我无法处理SQL语句,我必须向您寻求帮助。 表包含3列:
COlumn1 Column2 Column3
12345 1 Sometext1
23456 1 Sometext2
34567 1 Sometext3
45678 2 Sometext4
56789 2 Sometext5
我试图编写一个选择数据的查询:
12345 1 Sometext1
12345 1 Sometext2
12345 1 Sometext3
23456 1 Sometext1
23456 1 Sometext2
23456 1 Sometext3
34567 1 Sometext1
34567 1 Sometext2
34567 1 Sometext3
45678 2 Sometext4
45678 2 Sometext5
56789 2 Sometext4
56789 2 Sometext5
通常有1行:
COlumn1 Column2 Column3
**12345** **1** **Sometext1**
23456 1 **Sometext2**
34567 1 **Sometext3**
45678 2 Sometext4
56789 2 Sometext5
等等......
答案 0 :(得分:2)
如果我理解你的话,这就是你需要的:
SELECT t1.Column1, t1.Column2, t2.Column3
FROM your_table t1 join your_table t2 on t1.Column2=t2.Column2