473,387 Members | 3,820 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,387 software developers and data experts.

transposing table

Hi,

I would like to transpose a table in mysql. I have looked on the web for
a while but nothing seems to fit the bill, so I just want to clarify if
I have to write some php or if I can use a SQL query (preferred).
What I would like to do is to use the values in a row as column headings
during output, so that I can enter different sets of data into the same
table and display it in a readable format afterwards. Let me explain: I
have say a number of fields like so: name, email etc but I don't
necessarily know the number of fields. I may also want to enter data
coming from different sources into this table. I have thought about how
I uniquely identify each "set". So, instead of creating a fixed number
of columns, I would like the structure like this:

ID | FieldName | FieldValue | uniqueID

1 | name | me | 123
2 | email | me@somwhere | 123
3 | name | you | 456
4 | email | you@somwhere| 456

Afterwards, however, I would like to be able to query this table so I
can easily show

Name | email

me | me@somwhere
me | you@somwhere

I know I can write some code to loop through and do the job but before I
do that, I was hoping I could achieve this on the mysql end. Any
suggestions?

Thanks

Christoph
Jul 23 '05 #1
0 1974

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

Similar topics

2
by: Fabio | last post by:
Hello, is there any quite easy solution for the problem of transposing the rows into the columns? I have the following table with some data in it: dealer date 09.00 10.00 11.00 ...
8
by: Leszek Gruszka | last post by:
Hello! I need to transpose some columns into rows and rows into columns. I know, tha i can do it by cursor, but i don't know how make it... I read a lot about it, but still don't understand......
1
by: nipper1999 | last post by:
I have a set of data coming in from a text file that looks like: Date ID Value 01/01/2005 1 Value1 01/01/2005 2 Value2 01/01/2005 3 Value3 01/01/2005 4 ...
9
by: Classic-Car-World Ltd | last post by:
Hi, I have some data in a table in columns which I need to convert into rows. This is specification data for some tools etc. The data is currently in the following format: Product No, order,...
1
by: Caspian | last post by:
Dear All, I'm attempting to create a query that will transpose repeated fields into a single table structure. Can anyone think of how this can be done as I'm stumped at the minute? I'd like to...
4
by: m.wanstall | last post by:
Hi there, I have a large table based around a CustomerNumber with various details about that customer (originally imported and augmented from an Exchange Server)...now, a single customer can...
3
by: newb | last post by:
Hey guys, I’m new to access and databases and I’m having a bit of trouble coming up with a query that will do what I need. I have three tables in the form of: Table 1: Category ID, Category ...
11
by: Haydee Zimmerman | last post by:
Hoping someone can help me. I have 2 Access tables with a one to many relationship. the 1 side table holds the billing information, the many table side holds the billing id and modifier#. Now I...
7
by: ekariuki | last post by:
Hi Guys, I am a newbee to Bytes currently working on an MS Access database for one of my clients: With respect, I'll get right to it: I have 2 tables: Table 1. TblTrip_Facts Route Name , ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.