I am having troubles figuring out the best way to approach writing a query. A simplified version of my database is as follows:
Tests table:
TestData table:
The query I need:
…which basically combines the two tables, and displays them onto a single row. I guess what I need is a subquery that extracts the information from TestData where TestID matches, ordered by Volume, and fill the LoVol/LoVolMean fields with the first record found, then fill the HiVol/HiVolMean fields with the next record (or with blanks if there is no second record). I’m just not sure how to proceed. Does anyone have any suggestions?
Tests table:
Code:
TestID CatalogNo
1 1002-11
2 1002-11
3 1002-12
TestData table:
Code:
TestID Volume Mean
1 5 4.121
1 50 50.211
2 5 4.88
2 50 50.21
3 10 10.02
3 100 100.361
The query I need:
Code:
TestID CatalogNo LoVol LoVolMean HiVol HiVolMean
1 1002-11 5 4.121 50 50.211
2 1002-11 5 4.88 50 50.21
3 1002-12 10 10.02 100 100.361
…which basically combines the two tables, and displays them onto a single row. I guess what I need is a subquery that extracts the information from TestData where TestID matches, ordered by Volume, and fill the LoVol/LoVolMean fields with the first record found, then fill the HiVol/HiVolMean fields with the next record (or with blanks if there is no second record). I’m just not sure how to proceed. Does anyone have any suggestions?