Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5958041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:29:12+00:00 2026-05-22T18:29:12+00:00

İ have a video table named videos and here these are the columns :

  • 0

İ have a video table named videos and here these are the columns :

vid    v_uid    v_view   v_title   v_info
1       45      56487     foo       foo
2       45      455
3       45      98989
...

My condition will be ” where v_uid = 45 ” and i want to get rows belongs to this id “45” and sum this users video views as total views.

thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:29:13+00:00Added an answer on May 22, 2026 at 6:29 pm

    I read the question as you want to get all rows and a sum of those rows in one query.

    You could do this all in one hit using WITH ROLLUP, e.g.

    select *,sum(v_view) as total from videos 
    where v_uid=45 
    group by vid with rollup;
    

    Bit hacky, as we don’t really need the group by (which is why I’m grouping on the row id vid). What you’ll end up with all the individual rows, and a final row with the total sum in it (it will have a NULL vid too, which might help identify it)

    If you just want a sum of the views, then you can execute something much simpler

    select sum(v_view) as total from videos where v_uid=45;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a MySQL database table called 'Videos' with only three columns (fields?): ID,
I have the video gallery in my database, which has over 200 000 videos.
I have field in my sql table named 'content'. I have 300 records in
I have a simple table that prints our the list of videos and plays
I have this MySQL table: video (id int, name varchar(30), view_count int) I tried
Say I have a table called media to represent audios, images, and videos. Furthermore,
I have three tables: videos, videos_categories, and categories. The tables look like this: videos:
I have two tables: Videos -------------- VideoID VideoGroupID CreatorUserID and VideoTags -------------- VideoID TagID
I have video in my project. I play it with MPMoviePlayerController but app will
I have video served by Ooyala that plays fine on all devices. The problem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.