If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
SQL to pass a list of ID's and retrieve data
I am not a SQL user I have enough knowledge of it to be dangerous. I have a
list of some 400 sample ID's that are used to identify the samples in the different tables I have. I want to pull data from 3 different tables, to make it simplier lets call the tables 1,2,3 Now I want to pull data from only certain field in the table and lets call the fields CO2, N1C1, are from table1 Sulfur, NI, are from table2 HE,H2, are from table3 I have a list of 400 sampleIDs (sample1, sample2, sample3, etc...) that I want to pull this data from, how do I write the SQL for this? Again thank you for the help |
#2
|
|||
|
|||
SQL to pass a list of ID's and retrieve data
"How" depends on "what", as in "what data, what structure"? I don't have a
very clear picture of your table structure. If I interpret your example literally, you have different elements/molecules/??? in different tables. Why? What does having separate tables for some of these help you do? More info, please... Regards Jeff Boyce Microsoft Office/Access MVP "James" wrote in message ... I am not a SQL user I have enough knowledge of it to be dangerous. I have a list of some 400 sample ID's that are used to identify the samples in the different tables I have. I want to pull data from 3 different tables, to make it simplier lets call the tables 1,2,3 Now I want to pull data from only certain field in the table and lets call the fields CO2, N1C1, are from table1 Sulfur, NI, are from table2 HE,H2, are from table3 I have a list of 400 sampleIDs (sample1, sample2, sample3, etc...) that I want to pull this data from, how do I write the SQL for this? Again thank you for the help |
#3
|
|||
|
|||
SQL to pass a list of ID's and retrieve data
"How" depends on "what", as in "what data, what structure"? I don't have a
very clear picture of your table structure. If I interpret your example literally, you have different elements/molecules/??? in different tables. Why? What does having separate tables for some of these help you do? More info, please... Regards Jeff Boyce Microsoft Office/Access MVP "James" wrote in message ... I am not a SQL user I have enough knowledge of it to be dangerous. I have a list of some 400 sample ID's that are used to identify the samples in the different tables I have. I want to pull data from 3 different tables, to make it simplier lets call the tables 1,2,3 Now I want to pull data from only certain field in the table and lets call the fields CO2, N1C1, are from table1 Sulfur, NI, are from table2 HE,H2, are from table3 I have a list of 400 sampleIDs (sample1, sample2, sample3, etc...) that I want to pull this data from, how do I write the SQL for this? Again thank you for the help |
#4
|
|||
|
|||
SQL to pass a list of ID's and retrieve data
Can you write a query that will give you what you want for a single
sampleID ??? Seems to me that if you can do that, what you need is a way to step from that to feeding your query an arbitrary list of sampleID's. Assuming that you can do this, I'd suggest creating a table for your list of sampleID's: tblSamples SampleKey -- PK, Autonumber sampleID -- [text, from your example], Indexed, Non-Unique Manually enter a couple (or a few) of your sampleID's into this table. Modify your query to include this new table with an inner join between sampleID and your other table(s). Assuming that your list of 400 sampleID's is in one of the several formats that you can link or import into Access, then you should be able to write an append query to add your list of samples to tbsSamples [delete the test data first!]. Of course, as Jeff said, knowing your table structure would help us tremendously! -- Clif "James" wrote in message ... I am not a SQL user I have enough knowledge of it to be dangerous. I have a list of some 400 sample ID's that are used to identify the samples in the different tables I have. I want to pull data from 3 different tables, to make it simplier lets call the tables 1,2,3 Now I want to pull data from only certain field in the table and lets call the fields CO2, N1C1, are from table1 Sulfur, NI, are from table2 HE,H2, are from table3 I have a list of 400 sampleIDs (sample1, sample2, sample3, etc...) that I want to pull this data from, how do I write the SQL for this? Again thank you for the help -- Clif |
#5
|
|||
|
|||
SQL to pass a list of ID's and retrieve data
Can you write a query that will give you what you want for a single
sampleID ??? Seems to me that if you can do that, what you need is a way to step from that to feeding your query an arbitrary list of sampleID's. Assuming that you can do this, I'd suggest creating a table for your list of sampleID's: tblSamples SampleKey -- PK, Autonumber sampleID -- [text, from your example], Indexed, Non-Unique Manually enter a couple (or a few) of your sampleID's into this table. Modify your query to include this new table with an inner join between sampleID and your other table(s). Assuming that your list of 400 sampleID's is in one of the several formats that you can link or import into Access, then you should be able to write an append query to add your list of samples to tbsSamples [delete the test data first!]. Of course, as Jeff said, knowing your table structure would help us tremendously! -- Clif "James" wrote in message ... I am not a SQL user I have enough knowledge of it to be dangerous. I have a list of some 400 sample ID's that are used to identify the samples in the different tables I have. I want to pull data from 3 different tables, to make it simplier lets call the tables 1,2,3 Now I want to pull data from only certain field in the table and lets call the fields CO2, N1C1, are from table1 Sulfur, NI, are from table2 HE,H2, are from table3 I have a list of 400 sampleIDs (sample1, sample2, sample3, etc...) that I want to pull this data from, how do I write the SQL for this? Again thank you for the help -- Clif |
Thread Tools | |
Display Modes | |
|
|