sql 查询ids

idvalue1value2value3
1111
23221
4131

这时要 查出结果为 1,2,4 sql语句

select GROUP_CONCAT(id) as ids from databases limit 0,1

结果为string 1,2,4

SELECT group_concat(id separator ';') as a FROM `cmf_portal_category` WHERE  (  parent_id = 37 ) limit 0,1

//tp5写法:
$cate_drivers_infos = Db::name('portal_category')->field("group_concat(id separator ';') as ids")->where('parent_id = 37')->find()['ids'];

//结果集
结果为string  1;2;4;5
点赞

发表评论