A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

SQL to pass a list of ID's and retrieve data



 
 
Thread Tools Display Modes
  #1  
Old September 9th, 2009, 09:38 PM posted to microsoft.public.access
JAmes
external usenet poster
 
Posts: 904
Default 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  
Old September 9th, 2009, 10:15 PM posted to microsoft.public.access
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default 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  
Old September 9th, 2009, 10:15 PM posted to microsoft.public.access
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default 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  
Old September 9th, 2009, 11:38 PM posted to microsoft.public.access
Clif McIrvin[_2_]
external usenet poster
 
Posts: 629
Default 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  
Old September 9th, 2009, 11:38 PM posted to microsoft.public.access
Clif McIrvin[_2_]
external usenet poster
 
Posts: 629
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:30 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.