I have tried to use the query wizard to find unmatched records but it
doesn't seem to be going right. The results are still giving me some
records that are in both tables. I have two tables OriginalShops and
AddedShops. Both tables have the same information in them. I want to
find only records that are not contained it either tables. The
following is the SQL statement created from the wizard:
SELECT AddedShops.shop _name, AddedShops.addr ess_1, AddedShops.city ,
AddedShops.stat e, AddedShops.zip_ code, AddedShops.tele phone
FROM AddedShops LEFT JOIN OriginalShops ON AddedShops.tele phone =
OriginalShops.[PHONE NUMBER]
WHERE (((OriginalShop s.[PHONE NUMBER]) Is Null));
As I mentioned it doesn't look like it's finding umatched records. The
some of the records that it's returning are in both tables. Any help
would be appreciated. Thanks. 3 2583
You're doing a LEFT JOIN between a null field in one table and the same
field in another table. The result of such an operation is probably
undefined. Not sure. At any rate, you can't really join two tables on a
field that is null.
You seem to be looking only for original shops with no phone number, and
then trying to match that (empty) phone number in the added shops list.
Did you perhaps mean to do the join on the shop name:
SELECT AddedShops.shop _name, AddedShops.addr ess_1, AddedShops.city ,
AddedShops.stat e, AddedShops.zip_ code, AddedShops.tele phone
FROM AddedShops LEFT JOIN OriginalShops ON AddedShops.shop _name =
OriginalShops.s hop_name
WHERE (((OriginalShop s.shop_name) Is Null));
Now THAT SQL would bring you back a list of shops in the added shops list
for which there is no match in the original shops list, based solely on
shop_name. Of course, if the shop_name is typed even slightly differently
in the two lists, the added shop will not be matched, even though (from a
user viewpoint) that shop is in the original list.
Is there a way to used a wild card like an * say there's "john's
autobody service" listed in original shops can i run the same query
using "john's autobody * " against added shops?
Thanks.
Rick Wannall wrote: You're doing a LEFT JOIN between a null field in one table and the same field in another table. The result of such an operation is probably undefined. Not sure. At any rate, you can't really join two tables on a field that is null.
You seem to be looking only for original shops with no phone number, and then trying to match that (empty) phone number in the added shops list.
Did you perhaps mean to do the join on the shop name:
SELECT AddedShops.shop _name, AddedShops.addr ess_1, AddedShops.city , AddedShops.stat e, AddedShops.zip_ code, AddedShops.tele phone FROM AddedShops LEFT JOIN OriginalShops ON AddedShops.shop _name = OriginalShops.s hop_name WHERE (((OriginalShop s.shop_name) Is Null));
Now THAT SQL would bring you back a list of shops in the added shops list for which there is no match in the original shops list, based solely on shop_name. Of course, if the shop_name is typed even slightly differently in the two lists, the added shop will not be matched, even though (from a user viewpoint) that shop is in the original list.
I wasn't able to get a LEFT JOIN to work with any variation on LIKE that I
could think of. Someone else may know how to do that.
Meanwhile, here is another way to go at it. Use a subquery to count matches
in the original table. I based this test on finding the added shop's name
string anywhere in the original shop's name string. You might want to
compare only the left characters up to the limit of the added shop's name
(essentially what you're trying with the LIKE approach in the JOIN).
SELECT Shops_Added.Sho pName, (Select Count(*) From shops_original where
instr(1, shops_original. shopname, shops_added.sho pname)<> 0) AS Matches
FROM Shops_Added;
My instinct tells me that when you start having problems like this it's time
for me to ask a question like this: What is the situation that dictates
that you must be able to add records in another table but find out based on
string comparisons whether or not you already have the same record in
another table? Especially where you have no control over the string field
entries on which you're attempting your match?? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Justin Hoffman |
last post by:
This is a question concerning query optimisation. Sorry if it's a bit long,
but thanks to anyone who has the patience to help - This is my first post
here...
If I have two tables: 'tblContact' and 'tblCategory' where categories are
like:
Code Name
010101 Short
010102 Fat
|
by: Phil |
last post by:
I am looking to set up a hyperlink control on a form to retrieve letters
that correspond to a record on a form. That is, there may be 100 form
records, and I would like each of those form records to have a hyperlink
button or control on it. that when pushed, pulls up the unique Word document
associated with that form record. In this example, there would 100 unique
letters associated with 100 unique form records. I tried working with...
|
by: N J |
last post by:
Hi,
I want my form to tell me if there are similar records based on a certain
field. For example, I currently have a record open on my form with
123@abc.com as a data in a field. I want the form to search the table for
any other records with that same data in that field and tell me in a text
box....'This is an existing customer' if there is 2 or more records, or
'This is a new customer' if there is just one record.
TIA
|
by: tshad |
last post by:
How do I find (and set) a couple of labels in the Footer after a DataGrid is
filled?
I have a bunch of DataGrids that get displayed nested inside a DataList.
The datagrid looks like:
*******************************************************************************
<asp:DataGrid visible="False"
border=1
|
by: D. Dante Lorenso |
last post by:
I'm trying to build a table that will store a history of records
by enumerating the records. I want the newest record to always
be number ZERO, so I created a trigger on my table to handle the
assignment of version numbers:
CREATE TRIGGER "trg_audio_file_insert" BEFORE INSERT
ON "public"."audio_file" FOR EACH ROW
EXECUTE PROCEDURE "public"."trg_audio_file_insert"();
My trigger function looks like this...
| |
by: ET |
last post by:
Hi!
I'll need help on what todo with this information in table...
There has to be a unique on one column (Item ID, for inventory purpose)
but in many cases that ID is not known... thus, many empty records for
that column exist in a table.
I tried to create unique index (no duplicates), of course, it failed
because of many empty records...
Now, is there ANY way to keep those empty records, and allow new empty
|
by: john |
last post by:
In my form I have a master table and a details table linked 1xM. I can
search through the whole parent table but I also like to be able to search
through the child table fields to find parent records. Should I design a new
form for this or can I somehow make this work in the same form.
Thanks in advance,
john
|
by: aknoch |
last post by:
My basic situation is this - I ONLY want duplicates, so the opposite
of DISTINCT:
I have two tables. Ordinarily, Table1ColumnA corresponds in a one to
one ratio with Table2ColumnB through a shared variable. So if I query
TableB using the shared variable, there really should only be on
record returned. In essence, if I run this and return TWO rows, it is
very bad:
select * from TableB where SharedVariable = 1234
|
by: srusskinyon |
last post by:
I need some help getting unique records from our database! I work for
a small non-profit homeless shelter. We keep track of guest
information as well as what services we have offered for statistical
purposes.
I've been using
Here's the situation:
I have two main tables:
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |