Forum Replies Created

Viewing 15 posts - 16 through 30 (of 125 total)

  • RE: Performace issue when retrieving data from two tables

    Yes, I understand the questions, why I am willing to return all rows... stupid i am (it is a common question and probably NOT a good idea to return all...

  • RE: Left join return wrong/incorrect count from each joined table

    The result is same when using COUNT(expression) and COUNT(ALL expression)

    try following and see the difference - COUNT(All expression) is giving incorrect results.

    -- COUNT(DISTINCT expression)

    select VideoTitle,

    COUNT(distinct favoriteId) as TotalFavorite,

    COUNT(distinct ViewerTrackingId)...

  • RE: Left join return wrong/incorrect count from each joined table

    To solve the problem i may use following:

    select VideoTitle,

    COUNT(distinct favoriteId) as TotalFavorite,

    COUNT(distinct ViewerTrackingId) as TotalViewed,

    COUNT(distinct RatingId) as TotalRating

    from tblVideo v

    left join tblFavorite f on v.VideoId = f.VideoId

    left...

  • RE: How to find max value in which column

    This solved my query: Thank you very much for your time and efforts. appreciated.

    ;WITH highest_attendance

    AS

    (SELECT subject, attendance, ROW_NUMBER() OVER

    (ORDER BY attendance DESC)

    AS rn

    FROM (

    SELECT 'math'...

  • RE: How to find max value in which column

    OK, thanks for your suggest. could you plz. make a dynamic query example and let me know how it would be looks like?

    The reason is there are different classes with...

  • RE: How to find max value in which column

    Can't we simple move the colum to rows and get TOP 1. I think there would be another way to do this - right?

    I just want to make it sure...

  • RE: How to find max value in which column

    I used the following simple query and reached on same results as your query results:

    select sum(convert(tinyint,Math)) as Math, sum(convert(tinyint,Physics)) as Physics, sum(convert(tinyint,Chemistry)) as Chemistry from results

    but i don't know...

  • RE: Query to find matching databases

    Hello all, I still have this as a question because when on Production, the user context running this script does not have such rights (sysadmin) as we are deploying the...

  • RE: video viewing query

    Hello Lutz, I have fixed few things from your example as that was not exactly covering my real scenario- Anyway I had resolved them and I made following changes:

    1- Limit...

  • RE: video viewing query

    Lutz, The output is giving number from 1,2,3 up till 70. It should be 50 (Fixed) and its value should be the actual video length divided by 50 with increment...

  • RE: video viewing query

    Lutz, The output is giving number from 1,2,3 up till 70. It should be 50 (Fixed) and its value should be the actual video length divided by 50 with increment...

  • RE: video viewing query

    To resolve this I am doing it in two parts:

    First query to make data as shown in red table:

    declare @userid int

    declare @VideoId int

    declare @LastUserId int

    declare @LastVideoId int

    declare @LastVideoTrackingId...

  • RE: video viewing query

    yes you are right with your few comments but for actual data i have uploaded new file which is the actual Tracked data and explained visually to have to make...

  • RE: video viewing query

    The first table (written with data with actual question not the red color table in image) is the information how the user viewing is stored in table. And if you...

  • RE: How to pick specific data from a varchar(250) size column

    Stuck in next step, there are some other values which does not work with my existing function. here is the new sample data:

    ?link=ProductsAndServices?src=NLVANOV10_lid={5F86099C-AFDD-DF11-80B8-001CC023728E}&stid=1&ptu=1

    ?src=NLVANOV10_lid={5F86099C-AFDD-DF11-80B8-001CC023728E}&stid=1&ptu=1

    Should check both & and _lid both -...

Viewing 15 posts - 16 through 30 (of 125 total)