April 21, 2003 at 3:11 pm
how would i denormalize my person table from structure
Person Table (person_id, household_id)
e.g.
person_id household_id
1 1
2 1
3 1
4 1
5 1
6 1
7 2
8 2
in which to a format of
(person_id1, person_id2, person_id3, person_id4, household_id)
in which all person_ids with the same household_ids are group together in which the first 4 person_ids are in one row, along with the household_ids, those are left are left to put in another row)
e.g. after denormalization we have
1 2 3 4 1
4 5 6 null 1
7 8 2
thanks in advance
April 22, 2003 at 3:10 am
Just a couple of questions:
I presume you actually want:
1 2 3 4 1
4 5 6 null 1
7 8 null null 2
in the data.
Secondly, do you need this data in a physical view/table, or would you be happy if it was returned by a stored procedure?
Also, out of interest, why do you want to see data this way?
April 22, 2003 at 7:43 am
A Physical Table is mostly preferred..
As for the reason.. well a client's mail house wants it done this way for mail distribution
April 23, 2003 at 2:55 am
Well,
If you built up a temporary table in a stored procedure, formatted exactly as you require, then returned that, then you would not have any problems with storing the same (kind of) data twie across 2 tables (how would you keep the 2 in sync? tricky).
You could call this SP whenever you needed data in this format, but the maintenance would all be done in your original (normalised) table.
What do you think?
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply