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 8601459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:50:56+00:00 2026-06-12T01:50:56+00:00

I have a table called BillingInformation with the following columns: id, clientId, type, order,

  • 0

I have a table called BillingInformation with the following columns:
id, clientId, type, order, value, timestamp

id is an artificial key
For each clientId on a particular date there will be 10 types e.g.

clientId   type              order    timestamp
1          Outstanding AR    0        2012-09-24 10:45:28.557
1          Est. Days In AR   1        2012-09-24 10:45:28.580
1          ...               2        2012-09-24 10.45.28.603
1          ...               3        2012-09-24 10.45.28.620  
1          ...               4        2012-09-24 10.45.28.630  
1          ...               5        2012-09-24 10.45.28.653
1          ...               6        2012-09-24 10.45.28.697
1          ...               7        2012-09-24 10.45.28.717
1          ...               8        2012-09-24 10.45.28.727
1          ...               9        2012-09-24 10.45.28.727
2          Outstanding AR    0        ...
2          Est. Days In AR   1        ...
(cont. 8 more rows for client 2)

My issue is that I have some clientIds where the 10 entries are in the database more than once and I just want to select just 10 (where order = 0 through 9) per client.

Here is my situation now:

clientId   type              order    timestamp
1          Outstanding AR    0        2012-09-24 10:45:28.557
1          Est. Days In AR   1        2012-09-24 10:45:28.580
1          ...               2        2012-09-24 10.45.28.603
1          ...               3        2012-09-24 10.45.28.620  
1          ...               4        2012-09-24 10.45.28.630  
1          ...               5        2012-09-24 10.45.28.653
1          ...               6        2012-09-24 10.45.28.697
1          ...               7        2012-09-24 10.45.28.717
1          ...               8        2012-09-24 10.45.28.727
1          ...               9        2012-09-24 10.45.28.727
1          Outstanding AR    0        2012-09-24 10:45:28.557
1          Est. Days In AR   1        2012-09-24 10:45:28.580
1          ...               2        2012-09-24 10.45.28.603
1          ...               3        2012-09-24 10.45.28.620  
1          ...               4        2012-09-24 10.45.28.630  
1          ...               5        2012-09-24 10.45.28.653
1          ...               6        2012-09-24 10.45.28.697
1          ...               7        2012-09-24 10.45.28.717
1          ...               8        2012-09-24 10.45.28.727
1          ...               9        2012-09-24 10.45.28.727
2          Outstanding AR    0        ...
2          Est. Days In AR   1        ...

(cont. 8 more rows for client 2)
(cont. 10 rows for client 3)
(and so on…)

No matter how many times the records 0 through 9 are repeated for client 1 for the day of 2012-09-14 (disregarding hours minutes seconds and milliseconds), I just want to select just one group of 10 along with the other records. So if any client has duplicated sets of 10 for the same month day and year, I just want one group of 10 for that month day and year.

Can anyone help me with this?

  • 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-06-12T01:50:57+00:00Added an answer on June 12, 2026 at 1:50 am
    select id, clientId, type, [order], value, timestamp
    from
    (
      select *, row_number() over (partition by clientId, [order],
                                                datediff(d,0,timestamp)
                                   order by timestamp desc) rn
      from BillingInformation
    ) X
    where rn=1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table called Reporting with following columns OutletId CampaignId ItemId Qty 10 1
I have table called posts in my DB. Each post has field called social_network
I have a table called 'MyTable' that looks like: ID | Item | Type
I have a table called sellerparams with a number of columns, one of them
I have a table called 'main_table' with 3 columns : 'player', 'points' and 'drop_date'
I have a table called 'survey_product' with the following structure: id int(11) order_id int(11)
i have table called type which contains data family,individual i want in some pages
Assuming I have table called events with the columns INT id DATETIME start_time DATETIME
In my oracle database I have table called PERSON with columns code, surname, forename.
I have table in my SQL Server database called OrderDetail which stores the order

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.