mysql select为重复列的第一行以外的所有内容返回空白 [英] mysql select to return blanks for all but first row of repeating column

查看:56
本文介绍了mysql select为重复列的第一行以外的所有内容返回空白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能创建一个mysql select(直接或使用存储过程),该选择将返回空白以重复列.例如,一个通常返回两列的7条记录的选择:

Is it possible to create a mysql select (directly or using a stored procedure) that will return blanks for repeating columns. For example, a select that would normally return these 7 records with 2 columns:

Bob   123
Bob   557
Bob   888
Joe   887
Joe   223
Tom   899
Tom   999

我希望直接从sql select中看到它:

I would prefer to see this directly from the sql select:

Bob   123
      557
      888
Joe   887
      223
Tom   899
      999

我意识到我可以对程序中的记录进行后期处理,但是我想用sql调用中的空白替换重复项.

I realize I can just post process the records in my program, but I'd like to replace the duplicates with blanks within the sql call.

推荐答案

是的,有可能,但是它会非常昂贵(子查询!),而且效率不高.无论您使用哪种语言,还是直接传输此数据,SQL都不要占用这几个字节是不值得的.

Yes, it's possible, but it would be very expensive (subqueries!) and not at all efficient. Whatever language you use or however you transfer this data directly, it's not worth it to have SQL spare these few bytes.

这篇关于mysql select为重复列的第一行以外的所有内容返回空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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