Home Override text in group by clause
Reply: 0

Override text in group by clause

user733
1#
user733 Published in June 19, 2018, 6:18 pm

I have a large table of data with descriptions that have been inconsistently entered. I'm trying to figure out how to include this field in a query and still group the records even if the descriptions don't match. In the example below I don't necessarily need the longest description, even if the result returns whatever description happens to be first that's fine. Thanks in advance!

SELECT PartNumber, Description, Sum(TotQtySold), year
From partsTable
GROUP BY PartNumber, Description, year

PartNumber|Description|TotQtySold|year
ABC123    |Repair Kit |5     |2007
ABC123    |kit        |3     |2007
ABC123    |Repair kit |8     |2007

Desired Result
ABC123    |Repair Kit |16    |2007
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.275444 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO