Results 1 to 2 of 2

Thread: QUEERy

  1. #1
    Join Date
    Dec 1969

    Default QUEERy

    hi,<BR><BR>i&#039;m storing details of images in the table with a field called KEYWORDS.<BR><BR>imgID KEYWORDS<BR>----- ---------<BR>1 A B C D E<BR>2 P Q R A B<BR>3 X Y Z asp<BR>4 asp is fun<BR><BR>when i&#039;m displaying it, i would like to see each word of the KEYWORDS field appear only once, like this<BR><BR>A B C D E P Q R Z asp is fun<BR><BR><BR>i wanted to do it using a query only but have&#039;nt made much headway & i need help... <BR><BR><BR>tia<BR>:-)newbee<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default Need to redesign DB

    It&#039;s usually a big mistake to put *lists* into a single field of a relational database, and you&#039;ve just shown another example thereof.<BR><BR>What you really need are *three* tables:<BR><BR>Table: Images<BR>imageID -- primary key<BR>imageDescription -- varchar <BR>... other stuff ...<BR><BR>Table: Keywords<BR>kwID -- primary key<BR>keywordName -- varchar<BR><BR>Table: ImagesKeywordsLinks<BR>imageID -- foreign key to Images table<BR>kwID -- foreign key to Keywords table<BR><BR>So now you put each keyword into the Keywords table only ONE TIME.<BR><BR>And then you use the ImagesKeywordsLinks table to tie things together.<BR><BR>So, now, you get a list of Keywords by simply dumping the Keywords table.<BR><BR>And you can make a *lot* of interesting queries that couldn&#039;t be done with the other DB design.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts