I have a SQL question along the lines of the one posted earlier, is there a way to return data from two or more cells in a table to one value. Such as I have one record that has multiple records associated with it and I would like to return 1 line with:
Would like to return:
___________________________________________________
Main_record Associated_Records
"Main_data1" "assoc._data1, Associted_data2, Associated_data3,etc."
“Main_data2” “assoc._data1, Associted_data2. etc..”
____________________________________________________
Currently returns:
____________________________________________________
Main_record Associated_Records
"Main_data1" "assoc._data1"
“Main _data1” “assoc._data2”
“Main_data1” “assoc._data3”
“Main_data2” “accoc._data1”
“Main_data2” “assoc._data2”
“etc…” “etc…”
____________________________________________________
There are three tables that contain this data:
Table one - Main record Table,
Table two - Associated Records table
Table three – Relating main and associated data Tables.
Since the user will be performing searches I never know how many main records or associated records will be returned. I will note that I am also using MSSQL for this. Is there a way to do this in SQL or am I stuck doing in the code? Hope this makes sense. Thanks