473,396 Members | 1,666 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

sum()/Group by Query Help

I have tried searching for a solution to this, but I can't seem to
find a good set of keywords, so I'm hoping some kind soul will answer
it for me. I'm not sure it is even possible, but it certainly seems
as though it should be.

mySQL 3.23, but can upgrade if necessary.

table1
------
Code Amount Company
---------------------------
1 10.00 Acme
1 20.00 Acme
1 10.00 Jones
1 20.00 Smith
2 5.00 Jones
2 10.00 Smith
3 15.00 Acme
3 15.00 Jones
3 20.00 Smith
Desired Output
--------------
Company Code1 Code2 Code3
Acme 30.00 0.00 15.00
Jones 10.00 5.00 15.00
Smith 20.00 10.00 20.00

I've spent the better part of 2 days pondering this with no luck - I'm
pathetic - someone either please give me a hint or tell me it can't be
done so I don't go nuts! Thanks!
Chad
Jul 19 '05 #1
0 2040

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Xenophobe | last post by:
I know this isn't a MySQL forum, but my question is related to a PHP project. I have two tables. table1 table2 "table1" contains 2 columns, ID and FirstName:
1
by: mbza | last post by:
Hi all, I'm trying to setup a database (mysql 4.0) for my snooker club and have run into a little problem, being new to myslq and php. I want to setup a table where all the results will go, then...
3
by: Omavlana | last post by:
Hi, I have writtem the query.... select sum( case when shmsharect >= 10000 then 1 else 0 end ) as cnt_big
3
by: Edward | last post by:
I am having conceptual trouble with the following query: select r.ServiceID,r.ContractID,sum(Total) from ( select csc.ServiceID,c.ContractID, sum(csc.ContainerMovement) as Total from...
1
by: Hought, Todd | last post by:
Hi all, trying to run a query against a table, to pull the date out, and order it. problem is, the date is stored in character (string) format, not as an actual timestamp, so parsing it back into...
1
by: Access | last post by:
I made a query with some totals. One of these totals I only get when using a subquery. I believe it must be possible to get the resulkt in one query ArtNr Total #order #customer...
5
by: Norma | last post by:
I am trying to make a query pull data from between the dates I enter in the parameter but also look back 'in time' to see where 2 other fields have null values, and only pull data into the query if...
1
by: Kevin | last post by:
Group By - Client Sum - PastDue: Iif(DateDiff("d",,Date())>30,,0) Sum - Current: Iif(DateDiff("d",,Date())<31,,0) These 2 sum fields work fine, EXCEPT it is not summing my negative...
1
by: rock72 | last post by:
Hello Everyone, Can anyone tell me how to create a running sum in query ? Days should be from 1st record 1, then 2nd record 2 and so on...... Thanks Tim --
14
mseo
by: mseo | last post by:
hi, I have two listboxes on for viewing all the products from products table the second one to select specific products from the first one can I get the sum using query for all the products in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.