All pastes #657867 Raw Edit

Miscellany

public text v1 · immutable
#657867 ·published 2007-08-15 04:02 UTC
rendered paste body
This is the table i would like to use as the referance that has all the data and tells the query where to get the other data

Table1
|--|----|----------|----------|------------|
|ID|Name|Referance1|Referance2|Referance...|
|--|----|----------|----------|------------|
|1 |K491|13        |43        |786         |
|--|----|----------|----------|------------|


The other data is stored here
Table2
|------|--------|----|
|DataID|DataName|Data|
|------|--------|----|
|13    |Bleh    |Sam |
|------|--------|----|
|43    |Dogs    |Dig |
|------|--------|----|
|Random|DataName|Dat |
|------|--------|----|
|Random|DataName|Dat |
|------|--------|----|
|Random|DataName|Dat |
|------|--------|----|
|Random|DataName|Dat |
|------|--------|----|

This is what i would like to recive in the end

Result

|--|----|----------|----------|------------|--------|----|--------|----|
|ID|Name|Referance1|Referance2|Referance...|Name1   |Data|Name2   |Dat2|
|--|----|----------|----------|------------|--------|----|--------|----|
|1 |K491|13        |43        |786         |Bleh    |Sam |Dogs    |Dig |
|--|----|----------|----------|------------|--------|----|--------|----|

I had tryed somthing like join until i relised that that would be no good as it would only join 1 row