Home  >  Article  >  Backend Development  >  又有难题了,唉解决办法

又有难题了,唉解决办法

WBOY
WBOYOriginal
2016-06-13 13:53:53884browse

又有难题了,唉
我把图片名存在数据库中了
有多个产品共用一个图
如:

prd_id     prd_name   prd_pic
1               NOKIA   1       1.gif
2               NOKIA   2       1.gif
3               NOKIA   3       2.gif

取出的时候怎么把1.gif放在一起取出?

------解决方案--------------------
select prd_id,prd_name from 数据表 where prd_pic= '1.gif ' order by prd_id
------解决方案--------------------
select prd_id,prd_name from 数据表 group by prd_pic order by prd_id
------解决方案--------------------
group by prd_pic

Statement:
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