View Full Version : Driving me cookoo!!!


disgruntled
08-10-2001, 01:57 PM
I have actaully asked this before but go no reply so i'll try my luck again. I need to retrieve a recordset from a table. The records i need to retrieve are related to another rs i've gathered which holds a list of keys. So me question is how do i write a query in SQL that takes 2 tables and returns the entries from the one only when the key is present in the other.

I am a newbie and lousy with the query builder if that is even poss. I have been writing all my queries in code thus far.

Help...I am at this road block all over my project.

Thanks a million.

Pat Hartman
08-10-2001, 07:33 PM
You should create two stored querydefs. If you are uncomfortable with the QBE interface, switch to SQL view. The first query would select the list of keys. The second query joins the first query to the table you want to select the related data from.

query1:
Select KeyField
From YourTable
Where TranDate > Date();

query2:
Select * from SomeTable
Inner Join query1 on SomeTable.KeyField = query1.KeyField;

PS, learning to use the QBE grid will save you a lot of typing and consequently typos. It is also simple to create correct joins since you just click and drag to connect the join columns.