Philippe Renaud
asked on
SQL Select Help
Hello EE,
i have a select result like this :
153010 11 LDS 14 803500046178 153 1 A001
153010 11 LDS 14 803500046178 153 1 A010
153010 11 LDS 14 803500046178 153 4 J03
153010 11 LDS 16 803500046185 153 3 A010
153010 11 LDS 16 803500046185 153 1 J03
153010 21 LDS 14 803500046277 153 3 A002
153010 21 LDS 14 803500046277 153 1 A010
you see that by UPC, i have multiple values (see last column)
I would like to add a column where i would see the total by UPC, a result like this:
153010 11 LDS 14 803500046178 153 1 A001 3
153010 11 LDS 14 803500046178 153 1 A010 3
153010 11 LDS 14 803500046178 153 4 J03 3
153010 11 LDS 16 803500046185 153 3 A010 2
153010 11 LDS 16 803500046185 153 1 J03 2
153010 21 LDS 14 803500046277 153 3 A002 2
153010 21 LDS 14 803500046277 153 1 A010 2
so it would be the count by UPC
how can I do this to the actual results?
i have a select result like this :
153010 11 LDS 14 803500046178 153 1 A001
153010 11 LDS 14 803500046178 153 1 A010
153010 11 LDS 14 803500046178 153 4 J03
153010 11 LDS 16 803500046185 153 3 A010
153010 11 LDS 16 803500046185 153 1 J03
153010 21 LDS 14 803500046277 153 3 A002
153010 21 LDS 14 803500046277 153 1 A010
you see that by UPC, i have multiple values (see last column)
I would like to add a column where i would see the total by UPC, a result like this:
153010 11 LDS 14 803500046178 153 1 A001 3
153010 11 LDS 14 803500046178 153 1 A010 3
153010 11 LDS 14 803500046178 153 4 J03 3
153010 11 LDS 16 803500046185 153 3 A010 2
153010 11 LDS 16 803500046185 153 1 J03 2
153010 21 LDS 14 803500046277 153 3 A002 2
153010 21 LDS 14 803500046277 153 1 A010 2
so it would be the count by UPC
how can I do this to the actual results?
ASKER
see picture for better explanations.
i want a column where it would say the count of upc in my table.
in my example, you see 4 rows with that upc: 803500105288
so in the new column, for each of this upc, i would see "4"
let me know if it makes more sense.
i want a column where it would say the count of upc in my table.
in my example, you see 4 rows with that upc: 803500105288
so in the new column, for each of this upc, i would see "4"
let me know if it makes more sense.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i made it happen with your code, i just changed the sum(Qty) to count(UPC_No)
thanks
thanks
Thanks for the grade. Good luck with your project. -Jim
Please add the column names to your data mockup, as I don't see a 'UPC' anywhere, and it's not clear what you wish to count.