mysql - 如何直接SQL查询出这种类型数据
阿神
阿神 2017-04-17 11:18:47
0
1
224

我有一个表,存储的数据类似这样:
id name age class
1 zhang 20 1
2 zhao 25 2
3 xing 22 1

现在我想按照class分类取出,怎么才能最简便查询出这种形式
array(
'1'=>('0'=>('1','zhang','20'),'1'=>('3','xing','22')),
'2'=>('0'=>('2','zhao','25'))
)

阿神
阿神

闭关修行中......

répondre à tous(1)
左手右手慢动作

直接 SQL 查询没可能达成你想要的效果,请在 Model 层重写逻辑完成你想要的需求。

Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!