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!

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

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.