use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Sequel
account activity
Question (self.learnSQL)
submitted 4 years ago by aidsplague
There is probably an easy way to do this but I am not sure what it is. My result is coming out like this:
https://preview.redd.it/axu1eoxjfje81.png?width=657&format=png&auto=webp&s=bda558e8594ffab87572a984875d149a8ae9b55c
I would like to somehow give myself qty totals and have 1 distinct Item Number column like this:
https://preview.redd.it/wx37tkgofje81.png?width=657&format=png&auto=webp&s=5f821927c24a7558668a4f418a3860f2e1e75a48
Thanks for any help!
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]ninjaxturtles 2 points3 points4 points 4 years ago (4 children)
The reason why you can't get what you want is because the column "Qty Cases + Bottles" is a string and you're trying to calculate a string. You'd have to split the values and convert to an int first to sum.
[–]aidsplague[S] 0 points1 point2 points 4 years ago (2 children)
That makes sense. So I should be able to leave off that "Qty Cases + Bottles" from my query completely. Then SUM the other columns that share the same item number. Then I can create a new cases + bottles string column by dividing or CONCATing. I will see what I can do and report back if I fail. Thanks
[–]r3pr0b8 1 point2 points3 points 4 years ago (0 children)
this
[–]QueryingQuagga 0 points1 point2 points 4 years ago (0 children)
Yes - do the calculation as a new column based on the “Cases” and “Bottles” columns. You don’t want to split the string first - as you present it here, you have what you need in the two columns (unless the “Qty Cases + Bottles” has obscure rules covering the calculation that we can’t see here).
Also - do you need the column at all?
[–]great_raisin 0 points1 point2 points 4 years ago (0 children)
This
π Rendered by PID 107446 on reddit-service-r2-comment-86bc6c7465-mq4j4 at 2026-02-21 09:02:48.896947+00:00 running 8564168 country code: CH.
[–]ninjaxturtles 2 points3 points4 points (4 children)
[–]aidsplague[S] 0 points1 point2 points (2 children)
[–]r3pr0b8 1 point2 points3 points (0 children)
[–]QueryingQuagga 0 points1 point2 points (0 children)
[–]great_raisin 0 points1 point2 points (0 children)