0

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 by sdhawan: wrong title

4
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by sdhawan
0

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

0

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 by jlenriquez: n/a

0

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 topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.