I hope this question has not been asked before. I have a csv file containing below columns and info and I can upload this to sqlite3 database with the exact same column names
Company Type Qty Price
ABC r 5 $$$
ABC h 9 $$$
ABC s 10 $$$
DER a 3 $$$
DER z 6 $$$
GGG q 12 $$$
GGG w 20 $$$
but, how do I get the below result on a csv file? Basically, grouping by the company name and still showing Type, Qty and Price, and at the end of lines showing the total qty for each company.
Company Type Qty Price Total Qty
ABC r 5 $$$
h 9 $$$
s 10 $$$ 24
DER a 3 $$$
z 6 $$$ 9
GGG q 12 $$$
w 20 $$$ 32
I have been trying with GROUP BY, but no luck. Any help is much appreciated Thank you
UNION.But why don't you separate this in two expressions: The first is selecting and ordering the data and the second one is doing the group by and the sum. If you post the code to create and fill the db I can help you further.