SELECT tagName, count + ( SELECT COALESCE(SUM(tn.count)...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

SELECT  tagName,
        count +
        (
        SELECT  COALESCE(SUM(tn.count), 0)
        FROM    tagSynonyms ts
        JOIN    tags tn
        ON      tn.tagName = ts.sourceTagName
        WHERE   ts.targetTagName = t.tagName
        ) count
FROM    tags t
ORDER BY
        count DESC, tagName

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results