我有一个包含2行的独特表格。第一列是" word"第二行是"定义",像这样:
[表]
字|定义
buy | verb
car | noun
car | singular
car | countable
girl| noun
girl| singular
girl| countable
boy | noun
boy | singular
dog | noun
reds| adjective
reds| plural
我需要删除重复的条目(行)并将定义放在同一行但不同的列中:
[newtable的]
buy | verb
car | noun | singular | countable
girl| noun | singular | countable
boy | noun | singular
dog | noun
reds| adjective | plural
这似乎很容易,但我是一个初学者,需要使用sql查询。你能帮帮我吗?
由于
答案 0 :(得分:0)
使用Group_Concat
功能。
select word,group_concat(definition) As 'definition'
from crostab
group by word
答案 1 :(得分:0)
[表]
word | definition
abeyar | VaVeVhVjVkVmVpVrVtGa
abeya | SfGaYs
abeyera | SfGaYs
abeyerin | SmGaYs
abeyerín | SmGaYs
abeyéru | AaApGaYs
abeyéru | Zz
abeyéru | DdRr
abeyéru | YyGgKk
abeyéru | WwSs
abeyéru | XxCc
abeyéru | AaApGaYs
abeyerucu | SmGaYs
abeyeru | SaGaYs
abeyeru | Xxxxxx
abeyeru | SmGaYs
abeyonar | VaVeVhVjVkVmVpVrVtGa
abeyón | SmGaYs
abeyota | SfGaYs
这就是我需要订购的东西。 (你可以看到“abeyéru”有7行)。每个单词可以有1到10个不同的定义。
word | definition
abeyar | VaVeVhVjVkVmVpVrVtGa
abeya | SfGaYs
abeyera | SfGaYs
abeyerin | SmGaYs
abeyerín | SmGaYs
abeyéru | AaApGaYs,Zz,DdRr,YyGgKk,WwSs,XxCc,AaApGaYs
abeyerucu | SmGaYs
abeyeru | SaGaYs,Xxxxxx,SmGaYs