Avatar of PeterBaileyUk

asked on 

sql server update query

With Guy and stefans help I have a query that returns ConcatWordText I would like to amend it so that StrShort field in the tblwords(w)
is updated with that result.

use Dictionary

WITH    Filtered
          AS ( SELECT   W.Word, w.WordPosition, w.clientcode, w.ClientCodeWordPosition, w.StrShort
               FROM     tblwords w
                        LEFT JOIN tblwordtags wt ON W.clientcodeWordPosition = wt.clientcodeWordPosition
               WHERE    wt.word IS NULL and w.ClientCodeWordPosition like '95052350%'
    SELECT  o.ClientCodeWordPosition, o.clientcode, o.StrShort,
            RTRIM(( SELECT  I.Word + ' '
                    FROM    Filtered I
                    WHERE   I.clientcode = O.clientcode
				 order by i.WordPosition
                    XML PATH('')
                  )) AS ConcatWordText, o.WordPosition
    FROM    Filtered O
   order by o.WordPosition

Open in new window

Microsoft SQL Server

Avatar of undefined
Last Comment
Vitor Montalvão

8/22/2022 - Mon