If record is in X table then do not show in Y - how to design a criteria?

behedwin

Active Member
Joined
Dec 10, 2014
Messages
399
Hi

I have a row source that is based of Profile_Table.
The first column in this row source is Profile_ID

I want to create a criteria that exclude ID numbers if they are represented in Time_Table.

Example.
If i have Profile_ID "77"
It will show in my row source.
But if i add The number "77" in column Profile_ID (secondary key) in table Time_Table
I want this record to not show in row source seletion.

Is this possible?


If profile_table.profile_id = time_table.time_id then
exclude from query
else
include in query
end if
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hm, how?

How do i create a query that display all records that are NOT in Time_Table?

Time_Table have Time_ID that have a one to one relationship with Profile_ID in Profile_Table

I want a query that display WHAT records in Profile_Table are not represented in Time_Table?
 
Upvote 0
you can also write the SQL yourself

Code:
select * from Profile_Table t1 
where not exists (
    select * from Time_Table t2 where t1.profile_id = t2.time_id)

or

Code:
select * 
from 
    Profile_Table t1
    left join Time_Table t2
    on t1.profile_id = t2.time_id
where 
    t2.time_id is null
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,375
Members
448,955
Latest member
BatCoder

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top