Home > Database > Mysql Tutorial > mysql-求正确MYSQL的写法,请大神赤脚

mysql-求正确MYSQL的写法,请大神赤脚

WBOY
Release: 2016-06-06 09:33:19
Original
919 people have browsed it

mysqlsql

1.问题:我一直不清楚一个SQL算出一个特定结果的写法,想向大神请教

2.代码:
SELECT tb.*,tbc.comment
from blog_tinyblog AS tb,blog_tbcomment AS tbc
where tb.user_id=tbc.user_id AND

tb.num=tbc.now_num
group by tbc.num_tiny_blog
我写的SQL是这样的,结果如图:图片说明
可这并不是我想要的结果,我希望去除重复,将comment存储为一个数组,成为只有一条结果的形式,请大神赤脚。也许可能会说用 distinct,但是不行

图片说明
现在的情况是这样,可是我发的微博不止3条,有十几条,其他几条因为没有评论就不显示出来了,我不知道怎么写啊,我想显示所有的微博和对应的评论

Related labels:
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