Original posted: http://community.9cbs.net/expert/topic/3721/3721293.xml? Temp = .4743158 has table content: No. Content A Abca AAAA DDDB 1223B fkdjfd ....
Implementation: A ABC, AAA, DDDDB 1223, FKDJFD Requirements with a SQL implementation, such as: SELECT SUM from Table Group By No. - Test data crete table (No. VARCHAR (20), content varchar (20)) Insert table select 'a', 'Abc'Union All Select' A ',' Aaa'Union All Select 'A', 'DDDD' Union all select 'b', '1223'Union all select' b ',' fkdjfd '
- Processing Group Complement Mathematics Create Function Jointers (@sno as varchar (20)) Returns varchar (200) Begindeclare @s as varchar (8000) set @s = '' SELECT @ s = @ S ',' LTRIM RTRIM (content)) from (SELECT content from table where number = @ SNO) ASET @ s = stuff (@ s, 1, 1, ') return @send
- Query statement select number, dbo.JoinStr (Number) AS content from table Group BY number - Test Result: Number content A abc, AAA, DDDB 1223, Fkdjfd
====== With SQL Solution:
Http://community.9cbs.net/expert/topic/4323/4323684.xml?temp=.1937982
Table1: News --------------------------------------------------------------------------------------------- ------------ RSID Title Subject Class1 Sky Blue .... Primary School Article ------------------------- ----------------------------------
Table2: ModifyLogs ------------------------------------------------- ------------ RSID newsid name memo1 three have some typographic words, but also need to modify 2 1 idioms and some words in words -------------- ---------------------------------------------
I need to use a sonet name now inquiries such results ------------------------------------ --------------------- UNID Title Subject Class Name1 Sky Blue ..... Primary School Article Zhang San, Zhang 4
-------------------------------------------------- --------- That is to say, as long as it is called the name of the teacher, it is displayed in a field ..... Excrequisite ... Declare @tname varchar (4000) set @ TNAME = '' SELECT @ TName = @ TName RTRIM (B.NAME) ',' from modifylogs b Left join news a on a.rsid = B.NewsidSet @ TNAME = Left (@ Tname, Len (@tname) - 1) Print @tname
Select Distinct A.rsid As Unida, A.Title, A.Subject, A.Class, @ TName As Name from News Aleft Join Modifylogs B on A.rsid = B.Newsid