Re: Many columns (as FK) vs 3x more Columns (in the same table)
| From: | Jim Giner | Date: | Wed, 19 Sep 2012 19:12:56 +0000 |
| Subject: | Re: Many columns (as FK) vs 3x more Columns (in the same table) | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-48506@lists.php.net to get a copy of this message | ||
On 9/18/2012 8:52 AM, Bruno Sandivilli wrote:
Hi, i strugling to decide what is the best choice:
I have a 15 row x 3 columns Flash DataGrid, it means, for each row i have 3
values.
To represent this in my Database, I could:
1. Create 2 Tables : A Values table - with 3 columns ; and a Bill table
(with 15 foreign keys, each one pointing to one row in the Values table).
2. Create one Table with 45 columns (15 fields * 3 values for each
field).
I want to know, wich is the best choice?
To manage my query, now i have a SELECT with a thousand of leftJoins.
This is the best choice?
How could I run a query wich will give all results linked, like:
( column_1_val_1, column_1_val_2, column_1_val_2,
column_2_val_1, column_1_val_2, column_1_val_3,
etc...) ?
Thanks!
I don't get it either.
You have 15 rows with 3 cols each. So? Display them. Query them. Big deal.
What is the real difficulty here? I'm not seeing it.
(I don't read it as 15x3x3 - at least that's not what he said since he said 'for each row he has 3 values')