![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have posted a question in the Database design and theory ng, but I expect a lot of you will have suggestions to help me (and that ng doesn't seem very active). The post is here: http://groups.google.co.uk/group/com...frm/thread/5db |
|
Any help would be appreciated. |
#3
| |||
| |||
|
|
The design you aim at is known as EAV, and many frown at it. |
|
SELECT per.id, per.dob, Home = MIN(CASE ph.Type WHEN 'Home' THEN ph.Value END), Mob = MIN(CASE ph.Type WHEN 'Mob' THEN ph.Value END), |
#4
| |||
| |||
|
|
The design you aim at is known as EAV, and many frown at it. Is there a 'better' method for storing this type of data? If so I would be interested to know about it. |
|
SELECT per.id, per.dob, Home = MIN(CASE ph.Type WHEN 'Home' THEN ph.Value END), Mob = MIN(CASE ph.Type WHEN 'Mob' THEN ph.Value END), This works very well actually, and the execution plan seems very reasonable compared to previous efforts! There is a problem though, in that some of the attributes are defined as text columns, which of course we cannot use the MIN aggregate function on. Do you have any suggestions for how we can include text columns using similar syntax and without using sub-selects? |
![]() |
| Thread Tools | |
| Display Modes | |
| |