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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:48:57+00:00 2026-05-28T05:48:57+00:00

I have oracle backend for my application. The schema is designed such that I

  • 0

I have oracle backend for my application. The schema is designed such that I have user transactions split into 12 monthly transaction tables.. one for each month. Now I want to retrieve the top 10 users who have accessed highest number of distinct documents in a given date range.
I currently have a query which does countDistinct on documents for each user,sort in desc order of this count and select top 10 results from this.
I run this query over each table and all results are appended in a list. I have to scan this list and do a sum on monthly count and then group by user_id to get the document totals for each user across all 12 months.
I realised that this count is not the right count since there may be same documents accessed by same user in different months. with my current logic these count will get added up.

I need to know which strategy should I use so that the result will be the most accurate.. I know one way would be to query from single table, which will definitely give me right answer but can I achieve this same-result from querying all 12 tables?

here is a sample monthly table for january

class TxnSummJan {
    Long id 
    Transaction trans
    Users grauser
    Resources graresource
    Integer transactioncount
    Date lastaccesseddate
    Date currentdate 
    String accountid
    String userlocation

    String documentname

    String eventdesc
    }

Similar tables for each month..

  • 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-28T05:48:58+00:00Added an answer on May 28, 2026 at 5:48 am

    its me again.
    Could you apply UNION ALL to all 12 tables and then make it into a view?

    SELECT
      documentname,
      user,
      accesscount
      --and other columns
    FROM
    (
        SELECT 
          documentname,
          user,
          accesscount
          --and other columns
        FROM
          txn_jan
    
        UNION ALL
    
        SELECT 
          documentname,
          user,
          accesscount
          --and other columns
        FROM
          txn_feb
    
        --and other monthly summary tables
    
    ) yearly_summary
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an asp.net/C# application and backend as oracle. I need to use transactions.
I have a C# WinForms application with a database backend (oracle) and use NHibernate
I have a web application written in C#/ASP.Net and the backend DB is Oracle.
I have a legacy Struts 1.2.8 application that I'm maintaining and porting from Oracle
My application using Oracle 11g as backend. We have a multiple BLOB Columns in
We have a system with an Oracle backend to which we have access (though
I have an Oracle database backup file (.dmp) that was created with expdp .
I have an Oracle table which contains event log messages for an application. We
We have an Oracle database here that's been around for about 10 years. It's
We have several systems with Oracle (A) and SQL Server (B) databases on backend.

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.