473,385 Members | 1,712 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,385 software developers and data experts.

question on joins

I need to create a HTML table for a number of users. Each user will have a unique HTML table in regard to number of columns, as the user can choose to append columns to his HTML table.

The way I went about doing this is as follows:

create a table for the row count:
list
------------
id
user_id

The ID is the row of the table.

Then create a table with information on columns attached to the particular users HTML table:

list_label
------------
id
user_id
column_number
type
label


When a user appends a column to his HTML table a new record will be added where user_id = id in the list table, thus allowing me to find the number of columns in a particular users HTML table.

Then I create a table with the cell content for the users HTML table:

list_item
-------------
id
user_id
list_id
label
content_text
content_date
content_number

Now the users HTML table can be drawn:

The header:
SELECT * FROM list_label WHERE user_id = $userid ORDER BY column_number
result = (column1, column2... columnx)

l column 1 l column 2 l column3 l etc...
---+-----------+----------+---------+-------


Now I can fill out the cells in the HTML table from the tables above using data from the list_item table knowing that:
rows in the HTML table: list.id = list_item.list_id
and columns in the HTML table: list_item.label = list_label.label

Furthermore, the datatype in a particular column in the HTML table is given in the list_label.type variable, such that if for instance column 1 contains text the the row retrieved from list_item for that column should be content_text.

Now the question is: Is it possible to retrieve the HTML table in a single SQL query? And if so how do i do it?
Jan 24 '08 #1
3 1236
ronverdonk
4,258 Expert 4TB
All information about db's, tables, columns, contents and the rest can be found in MySQL's INFORMATION_SCHEMA tables. So you don't have to keep track of that.
See MySQL manual INFORMATION_SCHEMA

Ronald
Feb 15 '08 #2
All information about db's, tables, columns, contents and the rest can be found in MySQL's INFORMATION_SCHEMA tables. So you don't have to keep track of that.
See MySQL manual INFORMATION_SCHEMA

Ronald
Thanks a lot Ronald, I really appreciate it.

I'll try and check it out and see if I can solve it :-)

Max
Feb 19 '08 #3
ronverdonk
4,258 Expert 4TB
You are welcome! See you next time.

Ronald
Feb 19 '08 #4

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

Similar topics

3
by: Prem | last post by:
Hi, I am having many problems with inner join. my first problem is : 1) I want to know the precedance while evaluating query with multiple joins. eg. select Employees.FirstName,...
4
by: inline_four | last post by:
If I have a table with multiple foreign keys to various other tables, what's the best way to index them: one index that contains all of those columns, or multiple indexes containing one foreign key...
1
by: csomberg | last post by:
SQL Server 2000 When joining tables, some use: AliasTableName.ColumnName = AliasTableName.Column while others use LEFT/RIGHT etc JOIN ....... Is one better than the other in cases where the...
5
by: Timur | last post by:
Hi gurus, I have a problem to convert MS SQL Server application to DB2. I have a view which combines 7 tables ( table sizes 60millions rows, 3 mill, 1 mill, other small ones) I use this view to...
2
by: Fendi Baba | last post by:
I created a person table with various fields such as Suffix, Salutation, etc, Some of these fields may not be mandatory for example suffix. In the actual table itself, I only have a field for...
13
by: john | last post by:
I have table User-App and table App Profile User-App App Profile IDuser IDApp IDApp 1 34 34 1 45 45 2 34 2 45 2 90 3 34
3
by: Veeru71 | last post by:
I am not able to really understand the explain plan output in case of hash joins. When tables A & B are being joined, how do I know which table is being hashed during first phase (build phase) ?...
6
by: dunleav1 | last post by:
I have an application that uses the old join syntax instead of the SQL92 standards join syntax. I need to justify changing the code to the new standard. Is there any performance issue related to...
6
by: loffing4 | last post by:
I'm trying to write a query that selects the top five members of a forum based on how many total points they have. A member's total points are calculated as follows: (3 * # answers posted) + (10 * #...
36
by: TC | last post by:
I've used Access for many years. Several times, I've encountered a bug which I refer to as the "Vanishing Joins" bug. When it happens, joins vanish randomly from queries. More specifically, all...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
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
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.