SQL Recipes
A FREE cookbook for SQL queries and examples
Register FAQ Search Today's Posts Mark Forums Read

SQL - Questions and Answers Have a SQL question? Post it here. First do a search to see if someone hasn't already answered it.

Go Back   SQL Recipes a FREE cookbook of SQL queries and examples > SQL queries and examples > SQL - Questions and Answers

Reply
 
LinkBack Thread Tools Search this Thread
  #1 (permalink)  
Old 11-15-2007, 06:59 PM
AlexKatzman
 
Posts: n/a
Default ANY dialect question:

Combining Queries


I have run into a problem when trying to manipulate data from two tables. Basically I have two data tables one is named AFF and the other is named Balances. Neither table has a primary key because I have to import data from external sources to populate the tables. I am grouping multiple fields (Company ID #, Type Code) together to get distinct records. Both tables have many overlapping records which only differ on a field 'Source' which contains the date of the file from which the record was imported.

I would like to filter both tables for just the most recent 'Source' date for each company. I am able to do this by using the max function in a query on the 'Source' field and then using GROUP BY to isolate each company record. The problem is that when I want to combine both of my filtered tables, I am running into a problem. As there is no primary key to access the records by, I am joining the queries. This does not work very well.

I am having to do this in MS Access as that is where the source data is located. Is there an easy way to assign record numbers to a query in MS Access? If so, maybe I could create my own primary key field in a temp query.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Be the first to answer this question! Click on the 'Post Reply' button below.
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:47 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
Copyright (c) 2006-2008 SQL Recipes

1 2 3 4 5 6 7 8