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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:27:26+00:00 2026-06-17T07:27:26+00:00

I need to build one table that show all the sales for one day

  • 0

I need to build one table that show all the sales for one day that i’ve choosen.

I’ve allways used the dummy way, selecting the table products that had a sale in one day, then do a loop on a php table do get the other informations from others tables.

I wanna know if theres is a simple way getting the data.

TABLES:

table_products

pr_id | pr_name | pr_price | ..
------|---------|----------|
1     | TV      | 299.99   |
2     | RADIO   |  59.99   |
3     | DVD     |  49.99   |
..    | ..      | ..       |


table_sales

sa_id | sa_coupon | sa_day   | sa_month | ..
------|-----------|----------|----------|
1     | 101       |    4     |    9     |
2     | 102       |    5     |    9     |
3     | 103       |    5     |    9     |
..    | ..        | ..       |..        |
80    | 211       |    2     |    12    |
..    | ..        | ..       |..        |


table_sales_dt

sa_dt_coupon |  sa_dt_product_id      | sa_qtd      |
-------------|------------------------|-------------|..
101      | 1                  | 10          |
101      | 2                  | 5       |
102      | 1              | 5       |
103      | 3              | 8       |
211      | 1              | 15      |
211      | 2              | 10      |
211      | 3              | 5       |
..           | ..             | ..          |

i want to show the results like this:

Sales on month 9 (september)

N   PRODUCT  QUANTITY    PRICE   TOTAL
1 - TV     - 15       - 299.99 - 4499.85
2 - RADIO  - 5        - 59.99  - 299.95
3 - DVD    - 8        - 49.99  - 399.92

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-06-17T07:27:27+00:00Added an answer on June 17, 2026 at 7:27 am

    Something like this might do it:

    SELECT p.* FROM table_products p 
    LEFT JOIN table_sales_dt dt ON p.id = dt.product_id
    LEFT JOIN table_sales s ON dt.sa_dt_coupon = s.sa_coupon
    WHERE s.sa_month = 9
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a cache that responds to memory pressure like the one build-into ASP.NET.
I need to build a SQLite table that will consist of the following columns:
I need to build a solution, but exclude one project. How should I do
I need to build a keystore with all the needed SSL certificates to make
I need to build a configuration panel in the Plone control panel that store
I have a need to build a schema structure to support table of contents
I'm trying to build a CSS-based table that will be populated with information coming
Hi I need to build a table with two columns from a mySQL table.
I need to build an internal service that queues the DB for changes (in
I need to build a MySQL query that returns only the common columns for

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.