在一个表中显示不同的列和不同的列 [英] Displaying distinct columns and non-distinct column in one table

查看:38
本文介绍了在一个表中显示不同的列和不同的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个表,其中一个包含用户的信息(包括Log_Name),日志(您可以在其中找到Login)和评估(如果用户回答了评估").全部通过user_id字段连接.

I have 3 Tables one that contains the user's info (including Log_Name), the logs (in which you can find Login) and the evaluation (if the user answered the 'evaluation' or not). All are connected by user_id field.

我想以这种方式在php中输出它:

I want to output it in php in this manner:

您能帮我解决这个问题吗?

Can you help me in solving this.

有人建议我先循环Log_Name,然后在该循​​环内,我将循环登录名,然后在表中显示它们.但是我不知道该怎么做.

Someone suggested that I loop first Log_Name and inside that loop, I'll loop the Login then display them in a table. But I have no idea how to do that.

推荐答案

看看

GROUP_CONCAT(log.date)将返回逗号分隔的日期列表,然后您可以根据需要显示它.

GROUP_CONCAT(log.date) will return comma separated date listing then you can display it as per your need.

这篇关于在一个表中显示不同的列和不同的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆