I need to group by and sum to specific colAbdalla Elawad8yAsked Feb 25, 2018, 8:13 PM EST4 answersShareLinkedInXCopy linkSavehi guyspls help me i need to create query by group by and sum to specific columns and excute by where cluase like enter Country , please see the TBL Thanks .
I need to group by and sum to specific colAbdalla Elawad8yAsked Feb 25, 2018, 8:13 PM EST4 answersShareLinkedInXCopy linkSavehi guyspls help me i need to create query by group by and sum to specific columns and excute by where cluase like enter Country , please see the TBL Thanks .
Manav PandyaRank #166 · 14.3K reputation8y agoPosted Feb 25, 2018, 9:22 PM EST+1Hello Yes sir you can do as much as need I have just executed to show how to do that Can modify as per your requirement Like : selectSum(Column 1) ,Sum(Column 2) ,Sum(Column 3) ,// other values you want where search_variable = its_valueGroup by column 1 , column 2 , column 3 , I dont have complete table and data like you have so try it by your own Thanks +1
Manav PandyaRank #166 · 14.3K reputation8y agoPosted Feb 25, 2018, 8:33 PM EST0Hello You can try following simple Group by queryselect D.year , D.country , SUM(D.sum) as TotalSUM from Demo D group by D.year,D.country And output will be like : let me know if u need more help Thanks 0
Abdalla ElawadRank #1,443 · 1.1K reputation8y agoPosted Feb 25, 2018, 9:03 PM EST0Thank You MR Manav i need to bulid like this , select to following columns : TRD_YR COUNTRY_DESC_EN CC_CODE COMMODTIY_CODE VALUE WEIGHT QTY from Data ( This is table name ) okay 1. i need to search by COUNTRY_DESC_EN 2. sum fields (VALUE) , (WEIGHT) , (QTY) 3. GROUP BY CC_CODE 4. GROUP BY COMMODTIY_CODE ( I search like to first two digits (04) (07) etc..) 6.GROUP BY TRD_YR I need to summerize query to any country to every year i will attached file excel as given requirements 0
Abdalla ElawadRank #1,443 · 1.1K reputation8y agoPosted Feb 25, 2018, 9:12 PM EST0like this : but i need to pass one parameter (country) and display all years SELECT Data.COUNTRY_DESC_AR, Data.TRD_YR, Data.CC_CODE, Sum(Data.VALUE) AS SumOfVALUE, Sum(Data.WEIGHT) AS SumOfWEIGHT, Sum(Data.QTY) AS SumOfQTYFROM DataWHERE (((Data.COMMODTIY_CODE) Like [Enter Commdity Code:]))GROUP BY Data.COUNTRY_DESC_AR, Data.TRD_YR, Data.CC_CODEHAVING (((Data.COUNTRY_DESC_AR)=[Enter Country Name:]) AND ((Data.TRD_YR)=[Enter Year:]) AND ((Data.CC_CODE)=[Enter CC Code:]));0Join to answer this questionEvery answer you publish earns 20 SHARP.Create free accountSign inKnow the answer?Answer a question in the forums and earn +20 SHARP for every answer.See unanswered questionsForumsTop experts01Arun PottiAnswers in the forums20answers02Tahir AnsariAnswers in the forums5answers03Kamlesh KumarAnswers in the forums5answers04Sam HobbsAnswers in the forums4answers05Željko PerićAnswers in the forums3answers?YouYour name goes here.Every answer: 20 SHARP.JoinFull leaderboard →2026DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Manav PandyaRank #166 · 14.3K reputationPosted Feb 25, 2018, 9:22 PM EST
Manav PandyaRank #166 · 14.3K reputationPosted Feb 25, 2018, 8:33 PM EST
Abdalla ElawadRank #1,443 · 1.1K reputationPosted Feb 25, 2018, 9:03 PM EST
Abdalla ElawadRank #1,443 · 1.1K reputationPosted Feb 25, 2018, 9:12 PM EST
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts