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

You don't want to. Keep your current design.

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

Create a non - clustered index on Word column. That will speed up your query.

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.