473,395 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Help with Expression within Query

Hello,

I'm building a query in which a master set of data is linked to a
secondary table with the use of a unique identifier.

Basically, I'm looking to represent in the query whether or not the
line of data in the master table appears in the secondary table. I can
do that easily by showing all records in the master table and only
those lines in the secondary table that match.

However, what I'd like to do is create an expression that will say
"Yes" if the secondary table does not match that record and "No" if the
secondary table does match that record.

I built this expression:
Say Yes If Doesn't Match: IIf([SecondaryTable].[Unique
Identifier]=Null,"Yes","No")

However, it says "No" for every record, whether or not it matches to a
recordthe secondary table.

Can anybody point me in the right direction on this? Many thanks in
advance for the help.

Cheers,
Chris Hafner

May 2 '06 #1
1 1232
what if you just use a left join, and then test the foreign key of the
right side table for null?

SELECT A.Field1, A.Field2, B.ForeignKey, B.Field3...,
iif(IsNull(B.ForeignKey), "Yes","No") AS FKFieldIsNull
FROM A LEFT JOIN B ON A.PrimaryKey=B.ForeignKey)
....

You can get most of this done by using the "Find Unmatched" query
wizard and then adding a field to your query and testing the foreign
key of the "right side" table (the one that may not have records
corresponding to the other table's PK) that returns Yes or No.

(Yeah, I bet that explanation totally confused you... well, try the SQL
and go from there...)

Hope it helps a little.

May 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

39
by: | last post by:
I am trying to run the following agregate function in a parameterized query on Access2000: Min(.*sqr(./.)/) The query saved OK, but an attempt to run it results in the message: The expression...
17
by: the other john | last post by:
This should be fairly basic but I can't think of how to do this and I'm running out of time! I am developing a picture gallery and I can't figure out how to select "one" picture from each...
11
by: randi_clausen | last post by:
Using SQL against a DB2 table the 'with' key word is used to dynamically create a temporary table with an SQL statement that is retained for the duration of that SQL statement. What is the...
2
by: Arthur Dzhelali | last post by:
I have a two xml files schema is identical. When I read file into dataset and then bind dataset to the form. These are weather files we are getting from weather service. One file has only...
2
by: MX1 | last post by:
HELP! I have a query that gets a few values from a form. The problem I'm having is a date field in the query. When I put the value in the criteria, it works fine. When I put the same value as...
1
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am...
2
by: comp.lang.php | last post by:
I am trying to replace within the HTML string $html the following: With Where I'm replacing "action=move_image" with "action=<?= $_REQUEST ?>"
6
by: leeg | last post by:
Help please. Apologies but I am poor in access and programming :o) and am having trouble getting my head around this one!!...again!!! I need to have a query or report to flag up someone who has...
1
ollyb303
by: ollyb303 | last post by:
Hello, I have been using the following expression in Access as part of a statement to query an Oracle database: (Sum(CASE WHEN STATS_DAILY_SA.LOGIN_TIME > (STATS_DAILY_SA.SCHEDULED_TIME -...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.