Subquery Or VBA Loop through recordset

Excel_Kid1081

Registered User.
Local time
Yesterday, 22:20
Joined
Jun 24, 2008
Messages
34
Hello-

I am trying to create a query from a single table that has these two fields: PricingDate and SecurityID. Each week I get new data that is appended to the table. What I want to find is the New SecurityIDs that were not in last week's. Thus, I am looking to restrict my recordset to just a few new securityIDs.

I have two questions:
1) Am I better off trying to create a OpenRecordset and loop through each securityID or doing just a subquery?
2) Could somebody help get me started on some syntax?

thanks!!

EK
 
If the current week's data is in a different table to begin with, you could use the unmatched query wizard to find ID's in that table that aren't in the main table.
 
Thanks for the reply! but unfortunately, it is not in a different table to begin with as I just get the single table with all the data in it vs. having two separate tables.
 
I guess you could create 2 queries, one with this week's data and one with previous data, then run the unmatched query wizard against those.
 
Hello-

I am trying to create a query from a single table that has these two fields: PricingDate and SecurityID. Each week I get new data that is appended to the table. What I want to find is the New SecurityIDs that were not in last week's. Thus, I am looking to restrict my recordset to just a few new securityIDs.

I have two questions:
1) Am I better off trying to create a OpenRecordset and loop through each securityID or doing just a subquery?
2) Could somebody help get me started on some syntax?

thanks!!

EK

If the IDs have never been in the table before this week, would searching for an ID with a Minumum Pricing Date of this week find what you want?
Code:
Select SecurityID, Min(PricingDate)
From YourTable
Group By SecurityID 
Having Min(PricingDate)>= {Variable or value representing "This Week");
 
Good idea; that looks like it will work.
 

Users who are viewing this thread

Back
Top Bottom