Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
The customer wants me to count all the sales that has an especific type of item. For example:
Table: ITEMS, this are the items that the customer sales.
| Item | CodTypeItem |
|---|---|
| AA100 | 01 |
| AA900 | 01 |
| AC600 | 03 |
| PA333 | 02 |
TABLA: TypeItem, this are the cateroies of the items
| CodTypeItem | DesTypeItem |
|---|---|
| 01 | FOOD |
| 02 | DRINKS |
| 03 | OTHER |
TABLA: Sales,
| ID | Clien | Date | Total |
|---|---|---|---|
| 1 | Coca | 20161210 | 555 |
| 2 | Pepsi | 20161211 | 2156 |
| 3 | Pepsico | 20161213 | 100 |
TABLA: SalesDet, sales detail.
| ID | ITEM | TOTAL |
|---|---|---|
| 1 | AA100 | 1326 |
| 1 | PA333 | 200 |
| 2 | AA100 | 100 |
| 3 | AC600 | 667 |
The customers wants a table like this
| Type | Numer of sales | avg amount per sale | |
|---|---|---|---|
| Food | 2 | 500 | |
| drink | 3 | 123 | |
| other | 6 | 900 |
Check the attached app
I already found a way to do it. Thank you very much!