I'm totally new to SQL and I've inherited a customer's server (the company that managed it no longer exists). They need me to run a SQL Query that shows their inventory sold for pots.
Specifically, how many of each item sold by each price code during a specific period of time. The guy who pulled this info used a program called Crystal Reports, but he said these reports could be run via SQL Query. This is what they were able to get from the guy (he created the database) before he retired:
Items sold contained in: ARInvoiceDetails & ARInvoiceHdr
ARInvoiceDetails is the main table.
ARInvoiceHdr contains invoice date.
ARInvoiceDetails contains item sold + price code (price code contained in ARPriceLevels).
Item description is obtained from ICItems.
Size is obtained from ICItemSizes (ICValidSizes).
Note: categories and subcategories are also contained in ICItems using ICCategories & ICSubCategories
Selling Price (ARDetSellingPrice) - my note: I don't see this one, but I do see a ARDetUnitPrice.
Price Code (ARDetPriceLevelID).
Quantity Sold (ARDetQty).
My issue(s) is that I can't figure out how to pull the data from both tables. I've done a little research into join clauses, but don't there need to be at least one column in common between the tables? I've been analyzing the output from Queries that show the column names from both tables. There are NO common column names. There is, however, a column in each table that has the same data but different column names.
ARInvoiceDetails - column name: ArDetPriceLevelID (price code)
ARInvoiceHdr - column name: ArInvPriceLevelID (price code)
According to the person that requested the report, price code will tell them the size and color of pots. Any help would be appreciated! I have access to the server and can answer any questions if this isn't enough information. I can't stress this enough - I'm totally new to SQL and my level of SQL knowledge is poor at best. I'm using Microsoft SQL Server Management Studio version 10.50.4042.0