• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to write a join

Explorer ,
Jun 28, 2007 Jun 28, 2007

Copy link to clipboard

Copied

I am using an access database. I have a table name strat_data_call which has the fields rec_no, agency, due_dt and a table named ccd_data_call with fields strat_rec_no, user_id. When an action takes place against a particular record in the strat_data_call a record of that action is inserted into the ccd_data_call table with the rec_no field inserted into the strat_rec_no field and the cookie.user_id is insertered into the user_id.

I need to list all the records from the strat_data_call table which do not have corresponding records that were placed in the ccd_data_call table by the user who is signed on (cookie.user_id). The rec_no can be in the ccd_data_call table numerious times but can only be in there once for any particular user.

How would I write the sql to display this. I have tried several different joins but none work.
Thanks
TOPICS
Advanced techniques

Views

323

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Jun 28, 2007 Jun 28, 2007
mkt,

Try:

Select *
From strat_data_call s
Left Outer Join ccd_data_call c
On s.rec_no = c.strat_rec_no
Where c.user_id Is Null

Swift

Votes

Translate

Translate
Explorer ,
Jun 28, 2007 Jun 28, 2007

Copy link to clipboard

Copied

mkt,

Try:

Select *
From strat_data_call s
Left Outer Join ccd_data_call c
On s.rec_no = c.strat_rec_no
Where c.user_id Is Null

Swift

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 28, 2007 Jun 28, 2007

Copy link to clipboard

Copied

That is almost there. The only problem is the "null" logic. There will always be a user_id in the ccd_data_call table field. But it will depend on who put the record there. So, I need the records in the strat_data_call to display even if they find a match of the rec_no and no match for the user_id that is logged on.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jun 28, 2007 Jun 28, 2007

Copy link to clipboard

Copied

LATEST
entered in error

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation