get dupe/related id

0

Please login or register to vote for this query.

(click on this box to dismiss)

Gardening and Landscaping

Q&A for gardeners and landscapers

/*SELECT DISTINCT
  l.postid AS qid1,
  l.relatedpostid AS qid2,
  p.title AS question1,
  p2.title AS question2,
  CASE WHEN ISJSON(ph.text) = 1
    THEN CASE WHEN
        p.posttypeid = 1
        AND ph.PostHistoryTypeId = 10
        AND ph.comment = 101
        AND CONVERT(varchar(10), l.relatedpostid) IN STRING_SPLIT(TRIM('[]' FROM JSON_QUERY(ph.text, '$.OriginalQuestionIds')), ',')
      THEN 1 ELSE 0 END
    ELSE 0 END AS is_duplicate
FROM postlinks l
INNER JOIN PostHistory ph ON ph.postid = l.postid
INNER JOIN posts p ON p.id = l.postid
INNER JOIN posts p2 ON p2.id = l.relatedpostid
ORDER BY l.postid*/

SELECT
(SELECT value FROM STRING_SPLIT(TRIM('[]' FROM '[123,456]'), ',') WHERE value = CONVERT(varchar(10), 123))
as success

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results