Woocommerce aggregate report by each person type sold - filtered by date range for bookable product - sql

Does any functionality or SQL query exist to build a report on bookable products sold by the individual person type filtered by a date range? I'd like to see a count of each person type sold in each day across a month.
If not where are the individual sold person types stored in the woocommerce SQL tables?

Related

How to perform aggregate function in SQL based on a condition of the data?

I have a table with fields RegionName, Month and Mo.Rent Price. Each row contains values for a city's average rent price in a particular month. I want to use a SQL Query to pull the cities that have the lowest rent prices for each month. In other words, I don't want to find the city with the min rent overall. I want the min rent from the other rent values in that month. And I want that for each month. Anyone know what query I could use? Thanks I attached the table im working with below

sum from one table between dates of second table

I have a report table that has the following columns-
Item#/Location/Price Hold Date/ Price Execution date
And a sales table with -
Item#/Location/Date/Units
I'm trying to sum the units between the two dates in report table matching them based on item number and location into something like -
Item/Location/Price Hold Date/Price Execution Date/ Total Units Sold

sql insert monthly records (rows) from a single yearly annual

I have a table that stores a yearly budget for a single employee by product type such as below. Is it possible to have sql split the annual sums into another table by monthly numbers by product type ?
I may have misunderstood the question but you may refer to INSERT INTO

mdx query for showing YTD value of the whole set and the subset in the same table

I have customer dimension that contains business unit, customer name,.. and fact table with transactions made by each customer (with date of the transaction)
I need to show (in the same table) YTD number of transactions for all customers per business unit and, in another column, YTD number of transaction for all customers whose number of transactions has fallen by 40% in the last 3 months
I managed to get the list of customers whose transaction volume has fallen, but somehow I don't have an idea how to show in the same table (query) the YTD tran. volume of all customers per business unit and YTD volume of these specific customers per business unit

How can I maintain a stock report using Crystal Reports?

I want to take the following result with the help of query in Crystal Reports:
I have a stock table where three column's "type", "product", and "quantity" now I want that to drag two sql expressions in my report 1st is "INN" and 2nd is "Out" and it comes like if the "type" is purchase so it check the "product" field and ADD the quantity and if the type is Sale it less the quantity acording to "product"
So what query should I write to get the result?
You have a table with a type field. Given your question there are some things one can only assume to answer it. So I assume:
1. type is of the type smallint
2. it is 1 for purchases or receipts and 2 for sales or deliveries
3. you mean you need to know the final stock of products
Then the query is:
select product, sum((3-2*type)*quantity) as stock
from table_name
group by product
if you have other values for types you will have to use different formula than 3-2*type.
Good luck