hi my table looks something like this:

id word definition
1 welcome some def1
2 welcome some def2
3 welcome some def3
4
5
6
7
and so on for rest of the table
how can i write a query so that all the definitions for same word get inserted in one row rather than mutiple rows.

Thanks for the help

Edited 6 Years Ago by sdhawan: wrong title

I actually want to reduce the time when i actually pull data , i either want the data in same row or provide a unique id to all the same words.Thanks

Hi,

If you're open with changing the current design to support many-to-many relationship you may want to break it down into 3 tables:

Word_Table
--------------------------
id (surrogate primary key)
word

Definition_Table
--------------------------
id (surrogate primary key)
definition

and the last table that will define the many-to-many relationship

Word_Definition_Table
--------------------------
word_id
def_id

This design would have advantage if you're objective is to share a definition with multiple words (like synonyms).

Cheers,
Joel

Edited 6 Years Ago by jlenriquez: n/a

Thanks a lot for reply .Ok let me make this more clear.What i am doing is to read key and values from hashtable .When i insert them in databse i see there are keys which are same but each have different values.What i want to do is either glue all the values with one key or give them same index.Can anyone help me with this thanks.

This article has been dead for over six months. Start a new discussion instead.