Queries :: How To Join Tables With No Matching - Unique Fields

Jun 16, 2013

I am undertaking an analysis of corporate mobile phone data based on data from the phone provider. The base data consists of a number of monthly text files at transaction level for voice calls, data usage, billing/tariff information, international calls/transfers etc. I have set up VBA code to import the text file data into a number of Access tables.I would like to have a way of joining these tables but the only common field is the phone number (a text field with the groups of numbers separated by hyphens).

I confirmed that joining the tables on the phone number text field does not work.My idea was to create an additional table with just one row for each phone number and link that to the other tables by the ID in the new table. I was able to create this table [PhoneNumbers] (by creating a totals query of the phone numbers from the main call transactions table, I then dumped it into Excel and then imported it into a new Access table with an auto-generated ID column).My problem / challenge is how to get the ID column from my [PhoneNumbers] table to appear in each of the other tables so that I can join them effectively. In the Excel-world, I would have used a vlookup function.I even thought of performing this as an interim step in Excel but there are too many records / rows in some of my tables. It seems that the dlookup function is not what Im looking for and even if the IIF function is suitable, I cannot get the syntax to work for me.

View Replies


ADVERTISEMENT

Matching Two Fields In Two Tables

Nov 13, 2006

In a database I have two tables, one is linked to an excel sheet (our customers order) and the other is created via a "make-table query" from our business system.

In both tables I have the customers part numbers and neither contain a primary key.

What I need to do is compare the part numbers in both tables to find if a part number is present in the order but not in our business system.

I just cannot figure out how to do this.

Any ideas are greatly appreciated

/twallstr

View 2 Replies View Related

Find Matching Dates In Tables A And B / Then Populate Blank Fields In A From B

Apr 30, 2012

I have a table tROE with a field listing all dates starting 1/1/10 to date (populated), and three fields for currency exchange rates [USD], [RSD] & [EUR] which are empty and need to be populated. I have another table tROEPartial that has the exchange rates for some of the dates starting 1/1/10 but not all. Their structures are identical. I want to add the exchange rates from tROEPartial to tROE where the dates match, leaving the unmatched fields in tROE blank.

View 3 Replies View Related

Queries :: Matching Fields From Multiple Columns

Jun 26, 2013

I have a series of numbers in 30 columns. I want to identify where either of two numbers appear in the same record regardless of which of the 30 columns they are in.

OTHCPT2OTHCPT3OTHCPT4OTHCPT5OTHCPT6OTHCPT7
00300C1778C1820J0690 J2250 J2270
00300C1778C1820J0690 J2250 J2270
00300C1778C1820J0690 #NULL!#NULL!
2318095978C176788307J0131 J2270

For instance if 23180 and J2270 are in the same record I want to identify them for all of the records.

View 7 Replies View Related

Queries :: Checking That All Matching Fields Are True

Mar 21, 2013

For my query I have 3 tables.

TEAMS. This contains TeamID / TeamName and TeamManagerName.
TeamAPPLinks. This is a many to many relationship and contains TeamAppID / AppID and TeamID (TeamID links to Teams.TeamID and AppID links to Applications/AppIS)
Applications. This contains AppID / AppName / Pass/Fail.

So teams can have many applications and applications can have many teams.

I only want to show teams that have all applications that have the Pass/Fail column as PASS. I have managed to do this for FAIL runing a query in a query but obviously its different for PASS as all associated applications have to be a PASS, not just one FAIL for a FAIL.

View 4 Replies View Related

Queries :: Show All Fields With No Matching Records - One Table

Aug 14, 2013

How to get the following results using 1 table:

Field1 ID is an auto record ID, field2 ID is actually field1 ID assigned that record, in other words record 1 has a roommate (record 5) assigned to it, record 2 has a roommate (record 4) assigned to it

Table A

Field1 ID Field2 ID
1 5
2 4
3 6
4 2
5 1
6 8

Results records I'm looking to display for would be:
1 5
2 4
3 6
6 8

I only want to display all fields for records, but I don't want to show their matching record, so I want to display record1, but not record 5 because record 1 has record 5 as a roommate, want to display record 2 but not record 4.

View 5 Replies View Related

Queries :: Matching Two Tables With Count

Jan 20, 2014

trying to create a query in which I can select a count across two tables with matching postcodes.

Table 1 : Address database with column called 'STRIPCODE' (e.g. ME8, ME9, ME10)
Table 2 : Area Code table; each column has a list of area codes to match to the STRIPCODE column. (e.g. MEDWAY column will have all of the relevant area codes)

I would pretty much want a count of each match as below :

STRIPCODE
MEDWAY 650
BLACKPOOL 563
HULL 352

Have a few hundred areas to match and tired of going through these manually and entering counts!

View 3 Replies View Related

Queries :: Count Matching Postcode Between Two Tables

Sep 1, 2014

I have two tables, one being an 'Address' file and the other an 'Area' file which is a list columns ranging from 1-400 with groups of district level postcodes. For Example; column 1 will have postcodes such as BN1, BN2, BN3, BN4, BN5 etc. Each column has a separate group of postcodes.

Now, my 'Address' file also has a column within this labelled 'District' in order for me to create a straight join (between column number and District) in a query to count each group individually, but of course, do to this 400 times becomes quite tedious! (to say the least)

I would require the outcome to be as follows :

Area file - Count
1 - 469
2 - 201
3 - 0
4 - 3598
5 - 268
. - 101
. - 8936
. - 563
399 - 287
400 - 41

View 5 Replies View Related

Tables :: Combining Fields To Create Unique ID

Nov 14, 2013

How i would best combine values in a table to produce a 'primary key id number.'

For example: the first letter of a city in the ID and the next number available/auto number - Portsmouth -> P233

I know i can create this in a query however i want it as the unique ID for that record entry in a table. If that doesn't make sense i can try to elaborate some more.

View 14 Replies View Related

Tables :: Unique Identifier Over Two Fields On A Table?

Jan 22, 2015

Any way on a table that I can have a unique identifier over two fields? E.g.I have a login ID and a Domain field in a table with sample data below.

Login Domain

John Test
Jane Test
Fred Live
John Live

The login names need to be unique to the domain so the integrity cannot be breached. This has to fit into one table (although the domain is actually being pulled from a look up table so is in fact a numerical value) for ease of form creation.

View 2 Replies View Related

Queries :: Update Query Using Matching Criteria From 2 Tables

Oct 18, 2013

I have 2 tables that must be involved in this query. Both have the same fields; one is a temporary table created from an Excel import which will be deleted later, the other is the permanent table.

tblStoreProducts is the permanent table. It has a 2-field Unique index; there can only be 1 of any ProductKey for a StoreKey (there can be multiple ProductKeys within a StoreKey, and multiple StoreKeys for each product, but there can only be 1 entry for each unique combination of ProductKey/StoreKey).

tblImportToStoreProducts is the temporary table. It holds all of the ProductKeys for one StoreKey.

My query needs to identify any ProductKey in the tblStoreProducts that does not exist in the tblImportToStoreProducts for that StoreKey, and then it must set the MaxUnits field to 0.

Basically, the temporary table is this years' inventory for a particular store. If a product was in that store last year but it isn't there this year, the quantity must be set to 0 because the ultimate aim is reporting hazardous materials.

View 1 Replies View Related

Query Multiple Tables Using INNER JOIN And Multivalue Fields

Jan 28, 2013

Here is my current table structure (I have omitted some fields from this example and have given some sample data in italics to make the table structure more clear.

tblEmployees

ID (autonumber) 3
EmployeeName John
EmployeePhone 555999555
EmployeeLocation New York

tblClients

ClientID (autonumber) 1 , 2 , 3
ClientName ABC Company , XYZ Company, PQR Company
fkeyLocationID

tblLocations
LocationID 1 , 2
Location New York , Chicago

tblEmployeeClients (junction table)
fkeyID 3
EmployeeClients (multivalued number) 1,2

The junction table tblEmployeeClients only stores ID of the Employee and in the second column (which is a multi-valued field), the ID of each of the clients the employee Supports.

I am trying to generate a report that lists say, EmployeeName alongside the clients supported by the Employee (listing the client location is not required, however, it would be good to know how to do that as well).

The report (for the example above), should look like this:

Name Clients Supported
John ABC Company, PQR Company

Currently, I am able to get :

John 1, 2 i.e the client ID for the clients that the employee supports instead of the corresponding company names.

View 1 Replies View Related

Queries :: Join Fields Query

Jul 28, 2013

I tried doing a search but couldnt find the i needed.

Category_name Sku
cars 1
Trucks 1
Bikes 1
Phones 2
Tablets 2
Hats 3

and what i need to is something that will link all sku 1 category names in a new field with a | divider and then all the sku 2 category names together with | as a divider and so on. the amount of categories is different for every sku.

so it looks like this

Joined_categories sku
Cars|Trucks|Bikes 1
Phones|Tablets 2
Hats 3

And if this is easy enough, its not that important though but to delete duplicate category names when it transfers them across to a new field joined together.

View 14 Replies View Related

Queries :: Sum Two Fields On Left Join?

Jul 29, 2013

I currently have two tables each containing information that I need to complete a query, however the results of suming this information is incorrect.

Below is the structure of the table, one contains more fileds than the other however the joins are on the Date and the Name fields. I have added a few dummy results to show the format

Table 1
"Date" "Name" "Times Logged In"
10/01/2013 Chris 1
11/01/2013 James 3

Table 2
"Date" "Region" "Manager Name" "Name" "Times Logged Out"
10/01/2013 Scotland Cindy Chris 1
11/01/2013 Wales Robert James 2

Query Fields

"Data" "Region" "Name" "SUM Times Logged In" "SUM Times Logged Out"

I can see what the issue is, if someone hasnt logged out there would be no entry in the table so the result query would show "Times Logged In" as X and a blank value at "Times Logged Out." However if there is a value at "Times Logged Out", "Times Logged In" is displayed again and causes the SUM calculations to be incorrect.

how do I overcome this issue though? I can do two spereate queries on the tables to produce results for Times Logged In and Times Logged Out but cant seem to create one query to display both these results in one table.

What I want is IF the date in Table 2 = Date in Table 1 AND IF Name in Table 2 = Name in Table 1 THEN take the value from Logged In and place that in a column and the value from Logged Out and place that in a column.

View 2 Replies View Related

Queries :: Left Join On 3 Fields

Mar 21, 2014

I'm having problems doing a left join with 3 fields. I know I don't need the 3 fields for this example to align the data but, I deal with much more than this and need this functionality.

The query object I'm looking into is named 'left join' and the sql is as follows:

SELECT Act_Base.CustID, Act_Base.Chipset_ID, Act_Base.Product, Act_Base.Qtr, Act_Base.Qty AS Shipments, SE_Base.Qty AS SE
FROM Act_Base LEFT JOIN SE_Base ON (Act_Base.Product = SE_Base.Product) AND (Act_Base.Qtr = SE_Base.Qtr) AND (Act_Base.CustID = SE_Base.CustID);

I'm expecting to see 150 units in the SE.Qty field.

[URL] ....

View 5 Replies View Related

Tables :: More Than One Unique Values - Prevent Entry Of Duplicate Combination Of Fields

Nov 4, 2014

1. I have a database (see attached) with three tables all of them with the same fields. The first three are numbers (InCo_No, Proto_No, Year_No). Each of these fields (numbers) can be the same in the other table(eg. Year_No), but the combination of the three cannot be.

How can I prevent the entry of a duplicate combination of these three fields?

2. I want to have a form to fill the three tables separately, depending the values in the other fields.

How can I do this?

View 3 Replies View Related

Tables :: Merging 2 Fields Together To Create Additional Field - Unique References

Jul 23, 2015

Is there a way of merging 2 fields together to create an additional field

my database consists of 4 main tables (in order of relationships)

*HeadOfficeDetails
*SiteDetails
*ContainersOnSite *Contracts2015-2016

For example;

Account Reference: TEST
Site Number: 001

and the field i would like to have;

Site Reference: TEST/001

I would also like that when i add a new site to that account i will have TEST/002....

View 4 Replies View Related

Queries :: Prevent Duplicates With Unique Field Of Joined Fields

Nov 2, 2014

I have a client database that has recently had multiple duplicate entries. I need to reduce or negate this erroneous activity. I have a client table where I record amongst others, the following;

key
[christian_name]
[family_name]
[dob]
......

I believe that to prevent duplicate entrie via form I have created an additional field called "unique" given it as a unique index which I want to have populated with the joined fields first_name & last_name & dob (IE johndoe01/01/90), and then as user enters a new client it wont allow a duplicate.

However I need to fill all the existing customers (3600+) with the relevant joined existing data. If I create an expression I can cajoin the fields in a select query but when I try to make an update query the same syntax comes up with empty fields.

select query sql that worked to show field ...

SELECT divers.christian_name, divers.family_name, divers.dob, [christian_name] & [family_name] & [dob] AS Expr1
FROM divers;

update query that was empty ..

UPDATE divers SET divers.[unique] = [christian_name] & [family_name] & [dob];

View 4 Replies View Related

Queries :: Join Two Tables For Further Manipulation

Feb 1, 2015

I have two tables: products and orders.I would like to query the products only with orders using the product code and/or model number and join up all product and order information for further manipulation.

View 2 Replies View Related

Queries :: Join Data Between Two Tables?

Sep 3, 2014

I have two tables

first table : customer name,QUANTITY ,delivery date,product type

second table : customer name,QUANTITY ,delivery date,product type

i want to make query to sum the QUANTITY from the two tables and group by customer name and delivery date

View 14 Replies View Related

Queries :: Join Two Tables With Duplicates

Oct 19, 2013

I am trying to combine two peculiar tables in Microsoft Access and have been unable to do so even after doing a lot of brainstorming and searching on the internet.

The two tables are spend and export
Spend
+-------------+--------+-------+-------+
| Country | Metal | Month | Spend |
+-------------+--------+-------+-------+
| China | Iron | Jan | 100 |
| China | Iron | Feb | 200 |
| China | Iron | March | 300 |

[code]...

View 2 Replies View Related

Queries :: Join Data Of Two Tables Using Query

May 3, 2015

I have two tables with name of accone and the second with the name of acctwo. These two tables are same according to number of columns and also same according to data types and also same according to the column names just the data are difference and also one column (attribute) with the name of ID is same in both tables. Their is a primary key relationship (one-to-one) between these two IDs. I need a query that can combine the data of both of them and can be updated using query. I mean that data of first table and second table must become under one same column not two columns one for first table and second one for second tabel.

View 4 Replies View Related

Queries :: Creating A Query With Self Join Tables

Feb 11, 2014

I have a table called MiscORders where all the orders are tracked. There is an ID, order number , other fields and ParentorderID fields in it. Whenever an order is modified they create a new order with ordernumber and have the previous order number as the parent. The next time it is amended or closed another order is created with the parent order attached. Here is some sample data

Order ID OrderNum Parent order id
1 MISC 2013-10
2 MISC 2013-10A MISC 2013-10
3 MISC 2013-10B MISC 2013-10

Now I am creating a query that shows the lifecycle of the order

MISC 2013-10 Issue and deadline date MISC 2013-10A issue and deadline date MISC 2013-10B issue and deadline date.I tried to create a query using self joins to the same table. SQL is attached

SELECT MISCORDER.OrderNum, MISCORDER.[Date Issued], MISCORDER.[Deadline Date], MISCORDER_1.OrderNum
FROM MISCORDER LEFT JOIN MISCORDER AS MISCORDER_1 ON MISCORDER.OrderNum = MISCORDER_1.RescindedOrderID
WHERE (((MISCORDER.OrderNum) Not Like '*A' And (MISCORDER.OrderNum) Not Like '*B' And (MISCORDER.OrderNum) Not Like '*C' And (MISCORDER.OrderNum) Not Like '*D') AND ((MISCORDER_1.OrderNum) Not Like '*B'));

How can I put a condition on the table to show only records with order num ending with A. It is not working if i use it in the where condition..

View 1 Replies View Related

Queries :: Join 2 Tables But Filter Records

Jul 20, 2015

I want a query that gives me something like this from 2 different tables:

table1 - AA, AC, DE
table2 - AA01, AA02, AA03, AC01, DE01, DE02

query -
column 1 - column 2
AA - AA01
------ AA02
------ AA03
AC - AC01
DE - DE01
------ DE02

Is that possible?

View 3 Replies View Related

Queries :: Loop To Create New Tables With Unique Field Values

Sep 20, 2013

I have a table - (Table A) that has 2 fields X and Y. I would like to write a query or script to make two new tables based on the unique values found in field X. In other words, all data where field X = 1 would be written to a new table called "1" and all data wehre field X =2 would be written to a new table called "2".I would like this done automatically.

Table A
Field X Field Y
1 a
1 b
1 c
1 d
2 a
2 b
2 c

View 5 Replies View Related

Create A JOIN Of Different Tables Called Join A Variable And List

Nov 16, 2013

And then called this join as a symbol or variable, and then have it use to select the items from these joined tables, can this be done in Access? Here is an example of a code that I created, but it has an error message saying the FROM syntax is incorrect.

Code:
SELECT firstJOIN.trainID, firstJOIN.trainName, firstJOIN.stationID, firstJOIN.stationName, firstJOIN.distance_miles, firstJOIN.time_mins
FROM (trains INNER JOIN ((station INNER JOIN lineStation ON station.stationID = lineStation.stationID)
INNER JOIN bookingLeg ON bookingLeg.startID = station.stationID or bookingLeg.endID = station.stationID )
ON trains.trainID = bookingLeg.tid) as firstJOIN

Can Access do something similar to this, in the FROM statement I joined 4 tables, because each unique fields are in each table and I have to joined them to get those fields. I called this join firstJOIN and in the SELECT statement, I list those columns in the table by calling it firstJOIN.trainID. Can Access do something like this, but syntax it differently?

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved