私はこのようなテーブルを持っています:
ユーザーID | フィッド | 価値 1 | 1 | nameOf1 1 | 2 | 姓1 1 | 3 | 国1 2 | 1 | nameOf2 2 | 2 | 姓の2
そして、次のように変換/選択する必要があります:
ユーザーID | 名前 | 姓 | 国 1 | nameOf1 | 姓の1 | 国1 2 | nameOf2 | 姓の2 | ..
少し複雑ですが、次のようなことができます。
select distinct uid as uid,
(select value from dataTable as table1
where table1.uid=dataTable.uid and fid = 1) as name,
(select value from dataTable as table2
where table2.uid=dataTable.uid and fid = 2) as surname,
(select value from dataTable as table3
where table3.uid=dataTable.uid and fid = 3) as country
from dataTable group by uid