Skip to main content
Inspiring
December 9, 2006
Question

Hard one ... Relational Database queries SQL

  • December 9, 2006
  • 3 replies
  • 265 views


OK - I wanted something a little odd, basically a relational design, where
there is a 1 to many relationship, i.e. where there are several pictures

field Pic1
field Pic2
field Pic3

And they all go to one table of pictures ...

Anyone know how to do this, I thought it would be easier, but I am
completely stumped.
Gerry


This topic has been closed for replies.

3 replies

Inspiring
December 10, 2006

Sounds like I should try and go for a slightly different design approach..!

G


"PeteC" <noemailrequired@nospamrequired.co.uk> wrote in message
news:elffqq$dsj$1@forums.macromedia.com...
>G wrote:
>> OK - I wanted something a little odd, basically a relational design,
>> where there is a 1 to many relationship, i.e. where there are several
>> pictures
>> field Pic1
>> field Pic2
>> field Pic3
>>
>> And they all go to one table of pictures ...
>>
>> Anyone know how to do this, I thought it would be easier, but I am
>> completely stumped.
>> Gerry
>
> That sounds like an unnormalised many-to-many, to me.
>
> I would guess your current configuration is
>
> Datatable
> DataID
> PicID1
> PicID2
> PicID3
> DataDescription
>
>
> All pointing to the Picture table
>
> PictureTable
> PicID
> PicImageName
> PicDescription
>
> There shouldn't be any problems with getting that to work, but if you're
> working with more than a few thousand records, you need to consider
> putting a resolution entity in; change the Datatable to look like
>
> DataID
> DataDescription
>
> Leave the Picture table as-is, and create a new table DataPicture, as
> follows
>
> DataPicture
> DataID
> PicID
>
> And thats it. many-to-many solved.
>
> It can be tricky getting this sort of design working in the Dreamweaver
> GUI, but it's relatively simple if you hand-code it.
>
> HTH,
>
> Pete.
>


Inspiring
December 9, 2006
G wrote:
> OK - I wanted something a little odd, basically a relational design,
> where there is a 1 to many relationship, i.e. where there are several
> pictures
> field Pic1
> field Pic2
> field Pic3
>
> And they all go to one table of pictures ...
>
> Anyone know how to do this, I thought it would be easier, but I am
> completely stumped.
> Gerry

That sounds like an unnormalised many-to-many, to me.

I would guess your current configuration is

Datatable
DataID
PicID1
PicID2
PicID3
DataDescription


All pointing to the Picture table

PictureTable
PicID
PicImageName
PicDescription

There shouldn't be any problems with getting that to work, but if you're
working with more than a few thousand records, you need to consider putting
a resolution entity in; change the Datatable to look like

DataID
DataDescription

Leave the Picture table as-is, and create a new table DataPicture, as
follows

DataPicture
DataID
PicID

And thats it. many-to-many solved.

It can be tricky getting this sort of design working in the Dreamweaver GUI,
but it's relatively simple if you hand-code it.

HTH,

Pete.


Inspiring
December 9, 2006
I think we need a little more info as to what exactly you are trying to do.

It sounds like you want to assign X amount of photos to a particular "item"?



"G" <anom@NoWhere.ocm> wrote in message
news:elf2i6$bt$1@forums.macromedia.com...
>
>
> OK - I wanted something a little odd, basically a relational design, where
> there is a 1 to many relationship, i.e. where there are several pictures
>
> field Pic1
> field Pic2
> field Pic3
>
> And they all go to one table of pictures ...
>
> Anyone know how to do this, I thought it would be easier, but I am
> completely stumped.
> Gerry
>