473,397 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

SQL Totaling Diamonds by Date Crosstab in ACCESS

4
I have several related tables. One table lists orders with due dates for SKUs while another table lists components of a SKU (diamonds). A third related table lists diamond IDs and diamond inventory. One diamond can be included in multiple SKUs and one SKU can contain different types of diamonds. The SKU ID links the SKU component table. The diamond ID links the SKU component table and the diamond type table. The diamond table lists unique types of diamonds plus their total inventory and Diamond ID.

My boss wants me to return the # of diamonds by diamond ID we need to order and the due dates (month totals) minus the inventory on hand. Except the only problem, is that when i create a query, the due date repeats, thus giving multiple columns for each due date per diamond type, even though I only need one. This results in a total inventory subtracted from the total # of diamonds we need in each month. I would like a query that subtracts out the diamonds on hand from the earliest months and leaves the later months for our totals.

Any ideas? Can this be done?

Here is my tables list, this should shed more light on it. But this is actually an ACCESS crosstab with the months going across in columns and the Diamond IDs in rows.

Purchase Orders: There is a one to many between products and purchase_orders
PO_ID (Primary Key)
SKU_ID (Foreign Key)
Quantity_Ordered (numeric)
Due-Date (date)
Order_Completed(Yes/No)

Finished_Products_Table:
SKU_ID (Unique Key)
Product_Name
Product_Descritption

Diamond_Table:
Diamond_ID (Primary Key)
Diamond_Shape
Diamond_Size
Diamond_Quantity_In_Stock

Products_Diamond_Components_Table:
Diamond_Component_Key (Primary Key)
SKU_ID (foreign key)
Diamond_ID
Diamond_Quantity (integer)
Relationships: there is a one to many between diamond table and this table
and a one to many beetween product/sku table and this table
May 21 '09 #1
2 1747
puppydogbuddy
1,923 Expert 1GB
two things you can due quickly:
1. Change the DueDate column to a row header.
2. Add another column named MonthDue which will be based on the expression Month(DueDate) & Year(DueDate) and make that the Column Header in your crosstab. This will give you column totals by month as compared to daily columns.
May 24 '09 #2
Coxmg
4
I found the solution. I needed the keyword FIRST for the inventory column.
May 25 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Steve Elliott | last post by:
I have a query set up to gather together data between two specified dates. Shown in the query column as: Between #24/09/2004# And #01/10/2004# Is it possible to enter several different date...
2
by: carl.barrett | last post by:
Hi, I'm back with the same question as I still can't get it to display my data the way I want it to. The table lists information about a perpetrator involved with an anti social behaviour...
8
by: Penny | last post by:
(Access 2003 Multiuser Split DB, Windows XP Pro) Hi All, I would really appreciate just some basic tips on how to make a Crosstab Form based on a Crosstab Query. The query always has the same...
4
by: NormAmst | last post by:
I have a list of CPU processing times and job durations for an entire department at work. There are 3 classifications I am maintaining. CPU time during peak hours , CPU time during non peak hours...
7
by: sheri | last post by:
I have a field called date, the date is in the field like this 70925 (which means Sept. 25, 2007). I have another field called day, it is a text field. How do I write a query to populate the day...
5
by: HowHow | last post by:
First time using crosstab query because tired of creating queries and put them together in one query (such a stupid thing to do :D). Not sure how it works still. I have link table called...
2
by: Jim Devenish | last post by:
I wish to create a crosstab query as the record source for a report. It needs to count data between selected dates which are entered by the user in a popup window. The following Select query...
3
by: inglesp | last post by:
Hi everyone I've come across some perculiar behaviour in a little database app I'm making with Access. I have a form for users to create a filter for data that goes into a cross-tab query. One...
2
by: Immortal Nephi | last post by:
You may have heard diamond shape. You create one base class. One base class has member functions and member variables. You create two derived classes. All member functions and member variables...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.