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

  • Home
  • SEARCH
  • 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 6969235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:33:19+00:00 2026-05-27T16:33:19+00:00

Hy, I have these objects in a bridge card game: Tabble: Series SerieID Title

  • 0

Hy,

I have these objects in a bridge card game:

Tabble:
Series
SerieID
Title
DateAdded

View:
BoardCounter
BoardID
SerieID
Counter

The counter is the number of time each board has been played.
Now I need to establish a ranking based on the counter divided by the number of days of presence.

I figured out easily how to calculate the days:

select serieid, date, datediff(day, DateAdded, GETDATE()) Days, Title from auboardseries

But not being that much a T-SQL geek (mostly used to LINQ), I need help to create the new view.

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-27T16:33:20+00:00Added an answer on May 27, 2026 at 4:33 pm

    Here’s my stab at this based on a whole bunch of assumptions I’ve made about your question.

    Here’s my bootstrapping code to get sample data:

    Your series table

    DECLARE @series table
    (
    SeriesID int,
    Title varchar(10),
    DateAdded datetime
    )
    INSERT @series
    SELECT 1,'series 1','10-10-2011'
    UNION
    SELECT 2,'series 2','8-01-2011'
    UNION
    SELECT 3,'series 3','11-30-2011'
    

    Your BoardCounter View (it’s a table here but that shouldn’t matter and you said you’ve got that figured out already)

    DECLARE @BoardCounter table
    (
    BoardID INT,
    SeriesID INT,
    [COUNTER] INT
    )
    INSERT @BoardCounter
    SELECT 1,1,1000
    UNION
    SELECT 1,2,800
    UNION
    SELECT 1,3,600
    UNION
    SELECT 2,1,2000
    UNION
    SELECT 2,2,1600
    UNION
    SELECT 2,3,1200
    UNION
    SELECT 3,1,500
    UNION
    SELECT 3,2,400
    UNION
    SELECT 3,3,300
    

    Okay, the following should be the guts of the view you say you want. It’s just a join of the table and view above. Again, this is fine because once a view is created, in this situation, it’s just like a table. Nothing too fancy. I divided the counter by the days elapsed like you indicated. You’ll notice that I’ve converted both values to FLOATs first and rounded the result to two decimal places. That’s just an assumption on my part that you’ll want a fine grained ranking. You can adjust that as you like.

    select S.SeriesID, DateAdded as [Date], ROUND(CAST([COUNter] AS FLOAT)/CAST(datediff(day, DateAdded, GETDATE()) AS FLOAT),2) AS Ranking,S.Title
    from @series s
    INNER JOIN @BoardCounter bc
    ON s.seriesid=bc.seriesid
    

    So, you should be good to just change a few table/view/column names in this and slap a CREATE VIEW AS on it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have these objects: public class Class { public Guid Id {get;set;} public string
Suppose I have these domain objects: DataPoint ========= public int Id {get;set;} public int
I have a list of custom objects. These objects have 2 datetime properties on
I have an array of pointers to Objective-C objects. These objects have a sort
I have an array made of unlimited number of objects. These objects have the
I have these code in my views.py: array = [] p = Person.objects.filter(client=1,status='Complete').values('name', 'age',
I have a hashmap containing objects created via a constructor. These objects are in
If I have a bunch of objects, and within these objects is the string
I have a NSFetchedResultsController which is fetching objects from a NSManagedObjectContext . These objects
I have a Queue that contains a collection of objects, one of these objects

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.