By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,133 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Sum

P: 2
Hi,

I want to write a query in MySQL, ( I am still learning from Websites), for the desired result in the attachment.

I am not using a table rather, entering the path of the file with sheet name.

Please Help.
Attached Files
File Type: xlsx MySql.xlsx (9.2 KB, 9 views)
1 Week Ago #1
Share this Question
Share on Google+
4 Replies


P: 1
RangGuru, Thank for joining and Welcome to Bytes Community for IT Professionals!
1 Week Ago #2

zmbd
Expert Mod 5K+
P: 5,331
Hi NHB,
Please keep in mind, many people will not download attachments that are not specifically requested by one of our experts.

You would be much better off listing the data, using the [code/] format will hold a space deliminated table
Expand|Select|Wrap|Line Numbers
  1.    [A]  [b]  [c]
  2. [1] x    y    z
And showing the result you're after as an equation
sum([A,1],[B,1],[C,1]) = Sum(x,y,z)

Please read thru the FAQ for other suggestions on posting your question.FAQ/PHP
1 Week Ago #3

P: 2
Zmbd,

Thank You for your guidance. Kindly find below my requirement.

Name Type Value
A Labour 100
A Parts 200
B Labour 50
B Parts 150

The result expected is

Name Labour Parts
A 100 200
B 50 150

Thank You
1 Week Ago #4

zmbd
Expert Mod 5K+
P: 5,331
.... group concat might work......
Normally I like to put a full example; however, this is a bit much - this site is one I goto when playing with mysql:
http://www.mysqltutorial.org/mysql-group_concat/
Towards the bottom of the page page is a nice example.

Try writing the SQL
Run
if it doesn't work post back your SQL (formatted using the [CODE/] tool please :) ) along with your results and we can go from there!
1 Week Ago #5

Post your reply

Sign in to post your reply or Sign up for a free account.