In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly tells you about using sqlserver to imitate mysql function FIND_IN_SET to achieve group_concat function. You can look up relevant professional terms on the Internet or find some related books to supplement them. We will not dabble here, so let's go straight to the topic. I hope that using sqlserver to imitate mysql function FIND_IN_SET to achieve group_concat function this article can bring you some practical help.
First, judge that there is a certain value in a field separated by a comma
FIND_IN_SET is replaced by CHARINDEX (',', +',',', and,
Second, an example of group_concat imitating mysql
SELECT id, val= (SELECT [value] +', 'FROM tb AS b WHERE b.id = a.id FOR XML PATH ('') FROM tb AS a GROUP BY idSELECT id, [val] = STUFF ((SELECT') '+ [value] FROM tb AS b WHERE b.id = a.id FOR XML PATH (''), 1, 1,') FROM tb AS a GROUP BY id-- delete, create temporary table drop table # table1 Select * into # table1from (SELECT myId,'auto' as type) allData-- classifies and links data by myId Then sort select * from in reverse order by the length of the linked data (select myId, val=STUFF ((SELECT','+ type FROM # table1 AS b WHERE b.myId = ta.myId FOR XML PATH (')), 1, 1,') from # table1 ta group by myId) dd order by LEN (val) desc
Using sqlserver to imitate the mysql function FIND_IN_SET to achieve group_concat function will first tell you about here, for other related issues you want to know can continue to pay attention to our industry information. Our section will capture some industry news and professional knowledge to share with you every day.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.