Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert rows to columns

Status
Not open for further replies.
Feb 4, 2003
3
0
0
US
Hi,

I want to convert rows that have the same ID but additional data to one single row where the additional data would go to new columns.

For example:

ID Name Rate DistrPerc
-----------------------------------------
111 Amy 25000.00 5
111 Amy 30000.00 6
222 Bob 28000.00 2

and change it so it would look like this...

ID Name Rate1 DistrPerc1 Rate2 DistriPerc
-----------------------------------------------------------
111 Amy 25000.00 5 30000.00 6
222 Bob 28000.00 2
 
This gets asks lots of times in various DB/SQL forums - see thread183-459197 for starters, or do an advanced search for the exact phrase 'rows to columns'
HTH Dickie Bird (:)-)))
 
no no no no no!!!!

you should NORMALISE YOUR DATA! then you wouldnt have to do this anyway!

if youre looking for output use a report wizard
 
Could you give me more information about what NORMALISE is? I've tried to search it here, but didn't find help much. Thanks.
 
"Normalisation" is a kind of standard for clean db design - I'm sure there are whole books on it. More than the pathetic few pages from the begining of the Access manual. Sorry I don't have a sugestion/reference . . .

My reaction to these questions is - if you want a layout inspired by Excel, use Excel! Should be easy to dump your data into Excel and make a pivot table or what ever. DaPi - no silver bullet
 
there are various forms of normal(ity)

UN-NORMALISED (you)
1NF (no vector elements)
2NF where the primary key is of more than one attrib, no non-key attrib functionaly dependant on PART of that key
3NF - no non key attrib f.d. on any other non key attrib

( i think they are in the right order)

there should be a tutorial somewhere. normalisation is more of a prosess rather than a no-brainer. - dont bother with a quick fix. head in book all day breeds good results
 
apoligez for da spellink - dont bother with a quick fix. head in book all day breeds good results
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top