Tag:Field merge

  • Processing method of MySQL single field multi value segmentation and merging

    Time:2022-6-17

    Combined display of multiple values Now we have the requirements as shown in Figure 1 to figure 2 How do you do it? The following SQL: SELECT id,GROUP_CONCAT(DISTINCT str) as str from test GROUP BY id Relevant knowledge points GROUP_CONCAT GROUP_ Concat ([distinct] field to be connected [order by asc/desc sort field] [separator ‘separator’]) Split […]

  • SQL function merging a field together

    Time:2022-5-30

    Recently, it is necessary to query all the fields in the associated table and recombine them into one field. At this time, the ordinary connection query can not meet the requirements, and SQL functions are required to complete it: ALTER function dbo.getResCodesByOwnerId(@OwnerId INT) returns nvarchar(2000) as begin DECLARE @codes VARCHAR(2000) SET @codes=” select @codes=stuff((select ‘,’+residence_code […]