In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-24 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.