基本思路是: 使用groupConcat函数连接字段值之后,用字符串截取的方式获取指定位置的数值。
select
substring(GROUP_CONCAT(stock_data_id order by create_time ), 1, 6) - 此处为关键。
stock_data_id, stock_code, trade_date,count(*) from biz_stock_data where trade_date = ‘2022-01-10’
group By stock_code, trade_date
having count(*) > 1
本文介绍了一种使用SQL中的groupConcat函数结合substring来从特定位置提取数据的方法。通过具体实例展示了如何在查询中利用这些函数来筛选重复的数据记录。
1768

被折叠的 条评论
为什么被折叠?



