[Solved] Total quantity by style

Creating tables and queries
Post Reply
cartoonjazz
Posts: 54
Joined: Sun Sep 04, 2016 9:40 pm

[Solved] Total quantity by style

Post by cartoonjazz »

I appreciate any help that can be offered.
I have a table that shows skus including size, price and quantity listed vertically. I would like to generate a query that gives me quantity totals per style, grouping all items whose sku are the same before the first dash from the left.

table 1
Image

result
Image

thanks again
Last edited by cartoonjazz on Mon Jul 10, 2017 9:56 pm, edited 1 time in total.
openoffice 4.1.2 windows 10
UnklDonald418
Volunteer
Posts: 1546
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: total quantity by style

Post by UnklDonald418 »

Try something like

Code: Select all

SELECT  LEFT("SKU", LOCATE( '-', "SKU")-1) AS "Style", SUM("qty") AS "Total"  FROM "Table1" GROUP BY "Style";
You may need to adjust the column names to match those in your table.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
cartoonjazz
Posts: 54
Joined: Sun Sep 04, 2016 9:40 pm

Re: total quantity by style

Post by cartoonjazz »

fantastic thanks so much works great
openoffice 4.1.2 windows 10
Post Reply