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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:41:33+00:00 2026-05-13T08:41:33+00:00

I have my database set up as such: Each product I have has it’s

  • 0

I have my database set up as such:

Each product I have has it’s own table where it records the quantity sold/transaction # (so column 1 is “transactionID”, column 2 is “quantity”)

ex) p-backScratcher (where p- is indicative of “product”)

There are also tables for each year which hold records of each transaction that went through. Each of these tables holds the following columns: “transactionID”, “date”, “time”, “pt_CA”, “pt_DB”, “pt_VC”, “pt_MC”, “pt_CH”, “pt_AM”

ex) sales-2008, sales-2009, etc. etc.

I’d like to be able to reference a single table that holds all the records for each year without having to change the sql for the table to include a new year.

So for example, I’d want to query all transactions for “p-backScratcher”, I don’t want to have to type out

SELECT sales-2008.date, sales-2009.date 
  FROM sales-2008, sales-2009 
 WHERE sales-2008.transactionID = p-backScratcher.transactionID 
    OR sales-2009.transactionID = p-backScratcher.transactionID

…but rather:

SELECT sales.date 
  FROM sales 
 WHERE sales.transactionID = p-backScratcher.transactionID
  • 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-13T08:41:33+00:00Added an answer on May 13, 2026 at 8:41 am

    I’d like to be able to reference a single table that holds all the records for each year without having to change the sql for the table to include a new year.

    This is why you should not be using one table per product and one table per year.

    What you need is one “Product” table and one “Transaction” table.

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

Sidebar

Related Questions

I have a set of data in a website table that has multiple pages
I have SQLite3 database, which is populated with some large set of data. I
I have a database that logs when an employee has attended a course and
I have an entity relationship setup in my mvc2 application such that each user
I have a listview which loads its data from sqlite database. Each row in
I have a spreadsheet with a dataset of a number of transactions, each of
I have a list of objects in an asp.net page. Each object represents a
I have an existing database (PostgreSQL in my case), and would like to access
I have a database with columns looking like: session | order | atype |
I have a database in which there is a parent Account row that then

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.