July 20, 2010 at 6:33 am
Hi,
I have the below tables:
tbl_Member
pk_MemberId MemberName
1 Sagar Sawant
2 Paul Ericson
3 Mark Waugh
4 Steve Genry
5 Jecob Sabastian
6 Jon Henry
7 Shelly Gunawan
... ......
tbl_Source
pk_SourceId SourceData
1 Le Meridian
2 WNKL
3 Bamboo Chic
4 WNBJ
5 EEST
... ....
tbl_SourceData
pk_SDataId fk_MemberId fk_SourceId
1 1 1
2 3 2
3 1 4
4 2 3
5 4 5
6 5 2
7 3 1
8 5 3
9 7 3
9 7 4
.. .. ..
Member Object has more than 55000 members.
How to generate result like below
pk_MemberId MemberName Source
1 Sagar Sawant Le Meridian, WNBJ
2 Paul Ericson Bamboo Chic
3 Mark Waugh Le Meridian, WNKL
4 Steve Genry EEST
5 Jecob Sabastian WNKL,Bamboo Chic
6 Jon Henry
7 Shelly Gunawan Bamboo Chic, WNBJ
... ......
July 20, 2010 at 7:07 am
Are you looking for the query to produce the resultset or a way of exporting into a csv format?
Seeing as this is in the 7/2000 forum I would suggest that you create a DTS package to export the results into a flat file destination which is set up to use commas as delimiters.
The query you would need to accomplish this would be something like:
SELECT
T2.pk_MemberId,
T2.MemberName,
T3.SourceData [Source]
FROM tbl_SourceData T1
INNER JOIN tbl_Member T2 ON T1.fk_MemberId = T2.pk_MemberId
INNER JOIN tbl_SourceData T3 ON T1.fk_SourceId = T3.pk_SourceId
Rich
July 20, 2010 at 7:14 am
Hi,
Please find out the attached screen shots from my original post.
July 20, 2010 at 7:39 am
Solved this query problem.
Sagar
July 20, 2010 at 12:16 pm
Sagar Sawant (7/20/2010)
Solved this query problem.Sagar
Would you mind posting your solution? It's not only good forum etiquette.
It might also help people solving a similar issue. Or you might even end up with someone tuning your code even further...
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply