Dynamic tables & report

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
dimxasnewfrozen
Forum Commoner
Posts: 84
Joined: Fri Oct 30, 2009 1:21 pm

Dynamic tables & report

Post by dimxasnewfrozen »

I have two dynamically generated tables:

Field Names:
ID (PK),
Field Name

Field Values:
Field ID
Field Value

So given that a user selects field names with the ID of 1, 3, 5, 7

I need get results that look something like:

Field Name1 | Field Name3 | Field Name5 | Field Name7
value null test null
value2 value null null
value3 value4 null null

I explained that rather poorly - and I thought there was a Database section on this forum?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Dynamic tables & report

Post by Christopher »

Something like:

SELECT names.name, values.value FROM names JOIN values ON names.id=values.id
(#10850)
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Dynamic tables & report

Post by califdon »

dimxasnewfrozen wrote:I explained that rather poorly - and I thought there was a Database section on this forum?
There is. Just click on Board Index at the top of the page, then look for Databases.
Post Reply