Jump to content

Manipulating multi table data to flat file


bigdspbandj

Recommended Posts

Is there a query (joins, or nested query) that can merge multiple results into a single row?

 

There are multiple records from t2 that match up with t1 via t1's primary key.

 

Example:

t1:

iddescription

1apples

2oranges

 

t2:

idt1_idlabeldate

131added
2008-01-23

141modified
2008-01-23

132added
2008-01-24

142modified
2008-01-24

 

The only solutions I can think of are creating a temp table or to mess around with the loop to concat. a string with the data, but I am not sure which is best or of there is a more elegant solution.

 

Thanks!

Link to comment
Share on other sites

It wouldn't let me modify the original post so here is the table again.

 

Example:

t1:

iddescription

1apples

2oranges

 

t2:

idt1_idlabeldate

131added2008-01-23

141modified2008-01-23

132added2008-01-24

142modified2008-01-24

 

The result I would like to see is as follows:

 

iddescriptiondate_addeddate_modified

1apples2008-01-232008-01-23

2oranges2008-01-242008-01-24

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.