Home > Backend Development > PHP Tutorial > sql查询去除字段中相同的值

sql查询去除字段中相同的值

WBOY
Release: 2016-06-23 14:01:44
Original
969 people have browsed it

userid     group_concat(title)   group_concat(oid)         group_concat(statue)
1          保过,保过,教程      sp111,sp234,sp134       1  0  1
根据这个statue属性去除title值相同的内容为1 就保留 为0 就去除。
userid     group_concat(title)   group_concat(oid)         group_concat(statue)
1          保过,            教程      sp111,sp234,sp134       1    1                         


回复讨论(解决方案)

我的sql:select userid,group_concat( title),group_concat(distinct oid) from `djs_shops_products` group by userid; 
查询结果:


表结构

select userid,group_concat( title),group_concat(distinct oid) from `djs_shops_products` 
where status=1 
group by userid; 

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template