Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Speeding Shipping, Improving Compliance – Read the ScanCode Systems Case Study
  #1  
Old April 2nd, 2002, 06:13 AM
joshzero joshzero is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 1 joshzero User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question combining many rows into one

Please help me figure out a solution to this problem.

I have a table in Microsoft Access that tracks the amount of money received from various companies. In some cases there is more than one amount received from the same company. Here is some sample data from the table:

CompanyID, Date, Amount, Code

5, 12/18/2000, $250.00, B M
5, 7/3/2001, $350.00, SP
8, , $100.00, M
9, , $150.00, M
9, , $250.00, gen

I need to create a new table so that all data associated with the same CompanyID appears in the same row. See example below:

CompanyID, Date, Amount, Code, Date2, Amount2, Code2

5, 12/18/2000, $250.00,B M, 7/3/2001, $350.00, SP
9, , $150.00, M, , $250.00, gen

I know this is inefficient in terms of database design. However the reason I need this new table is to export the data into excel for further manipulation.

Any ideas on how I can accomplish this task? Any help would be appreciated. Thanks. -Josh

Reply With Quote
  #2  
Old April 9th, 2002, 01:50 PM
rycamor rycamor is offline
Gödelian monster
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jul 1999
Location: Pembroke Pines, Florida, USA
Posts: 2,298 rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 1 h 54 m 21 sec
Reputation Power: 41
Sorry for the briefness of this reply, but I am short on time these days:

You want a query, not a new table. Access uses the word "query" to mean what we often call a "view" in the world of SQL.

Specifically, you want a Crosstab query, which can reorganize columns into rows. Access happens to have a wizard for creating new queries, and "Crosstab Query Wizard" is one of the choices. Play with this for awhile, and if it doesn't make sense, bring your findings back here.

Once you have created this query, then the query can be imported into Excel via ODBC (just as if it were a table), or you can even just copy and paste the ouptut into Excel.
__________________
The real n-tier system:

FreeBSD -> PostgreSQL -> [any_language] -> Apache -> Mozilla/XUL

Amazon wishlist -- rycamor (at) gmail.com

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > combining many rows into one


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway