How to get tweets under topic and also the status whether the logged in user reported the tweet or not in sql server

 ALTER PROCEDURE [dbo].[SP_GETTWEETSBYTOPIC_REPORTEDSTATUS]

@TopicId INT,

@UserId INT

AS

BEGIN

select distinct tw.TweetId,tw.Id,tw.CreatedOn,

tw.TwitterHandle,tw.TwitterProfileLink,tw.Tweet,tw.TweetedOn,tw.Rating,

tw.NoofComments,tw.NoofLikes,tw.NoofReTweets,tw.IsActive,

(select

case

when ogr.userid IS NOT NULL and ogr.TweetId IS NOT NULL then CAST(1 AS BIT)

else CAST(0 AS BIT)

end as isreported ) IsReported from tweets tw

inner join tweettopic tt

on

tt.twtid=tw.id

left join ongoingreports ogr

on

ogr.TweetId=tw.TweetId and ogr.UserId=@UserId

where tt.TopicId=@TopicId and tw.IsActive=1 and  (UPPER(tw.Rating)='NEGATIVE' OR UPPER(tw.Rating)='FALSE')

END

Comments

Popular posts from this blog

Implement virtualisation in kendo drop down list using jquery ajax in mvc, aspx page

How to Create trigger to Update the NoofOrgs Count under each category in Category Table based on Temp Table in Sql Server

How to Preview the image and download which is in base64string format in mvc view using C#