Link to home
Start Free TrialLog in
Avatar of Philippe Renaud
Philippe RenaudFlag for Canada

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?
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

>you see that by UPC
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.
Avatar of Philippe Renaud

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.
sorry here is the pictureUser generated image
ASKER CERTIFIED SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
btw, please also use the image and code buttons and not the file attach buttons, as that keeps everything in one view and saves experts a lot of time clicking back and forth, which leads to faster answers. User generated image
i made it happen with your code, i just changed the sum(Qty) to count(UPC_No)

thanks
Thanks for the grade.  Good luck with your project.  -Jim