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
|
|||
|
|||
Querying from 2 Records
I need to pull information from two fields in a table into
one field in another. I am trying to condense it into one step but didn't know if it was possible. Right now I have to run a query for the one record and then go append the results from the second query into the record. |
#2
|
|||
|
|||
Querying from 2 Records
Why? As in "what business need do you have that requires you to redundantly
store data in two tables?" Generally, storing redundant data is not necessary in Access -- what's being "solved" can often be solved without resorting to redundant copies of the same data. And again, why? As in "why do you need to combine data from separate fields into one?" A tenant of good relational database design is that you DON'T store more than one fact in one field -- you are describing store two facts in one field. If you need to SEE the two fields combined, that's what queries are for. -- More info, please ... Jeff Boyce Access MVP |
#3
|
|||
|
|||
Querying from 2 Records
This is what is happening. In the customer table there
are 8 different categories of various accounts. For our reporting purposes we don't care about the differences and need to run certain processes on these numbers. I have to basically streamline the current database and I am trying to eliminate as much extra work as possible. Right now there are 8 different queries, 1 that makes a table and the rest to append all of the different accounts to this one table. I was trying to make it work with one query but that is where I was hitting a wall. When I try to combine them all, I only get instances where they match across, which doesn't happen. I tried changes the AND to an OR and it just crashes the query. I can't go back and make changes to the main system because it is a custom application that was designed by one of our vendors. I import their tables and am sort of handcuffed by their initial design. This is a sample of what I am trying to do - INSERT INTO [OD Case#] ( Account, CaseID ) SELECT Overdrafts.Account, tblCase.CASEID FROM tblCase INNER JOIN Overdrafts ON (Overdrafts.Account = tblCase.CUSTOMERACCOUNTNUMBER2) OR (tblCase.CUSTOMERACCOUNTNUMBER1 = Overdrafts.Account); It will run if I change the OR to an AND, but again the results are wrong. -----Original Message----- Why? As in "what business need do you have that requires you to redundantly store data in two tables?" Generally, storing redundant data is not necessary in Access -- what's being "solved" can often be solved without resorting to redundant copies of the same data. And again, why? As in "why do you need to combine data from separate fields into one?" A tenant of good relational database design is that you DON'T store more than one fact in one field -- you are describing store two facts in one field. If you need to SEE the two fields combined, that's what queries are for. -- More info, please ... Jeff Boyce Access MVP . |
Thread Tools | |
Display Modes | |
|
|