DECLARE @UserId int = 13924; DECLARE @PostCount int; DECL...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

DECLARE @UserId int = 13924;
DECLARE @PostCount int;
DECLARE @LinkPostCount int;
SELECT @PostCount = COUNT(*) FROM Posts WHERE OwnerUserId = @UserId;
SELECT @LinkPostCount = COUNT(*) FROM Posts
       WHERE OwnerUserId = @UserId AND (Body LIKE '%ffconsultancy%' OR Body LIKE '%fsharpnews%' OR Body LIKE '%ocamlnews%')

SELECT
  (100.0*@LinkPostCount)/@PostCount as "Percentage",
  @LinkPostCount as "Posts Containing F#ey Fragment",
  @PostCount as "Total Posts"

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results
:records returned in :time ms:cached