Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8253037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:44:17+00:00 2026-06-08T00:44:17+00:00

I have a question regarding a database query on unrelated tables. It is required

  • 0

I have a question regarding a database query on unrelated tables.
It is required that VBA isn’t used this time (requirement from my manager), which makes it hard.

My query must return 5 columns of data.
The first 4 columns are directly retrieved from the Output of a previous query, so that is easy.

Query Q_STOP_LOSS: 

Year  Contr_Pool_ID          Contr_Ins_ID      COUNTRY   Employees    STOP_LOSS
2010  Crédit Agricole CIB    QUATREM           2         6024
2010  Crédit Agricole CIB    QUATREM           2         6024
2010  Amada CO LTD           MALAKOFF MEDERIC  4         1320
2010  Amada CO LTD           MALAKOFF MEDERIC  4         1320
2010  Amada CO LTD           MALAKOFF MEDERIC  4         1320

The last column called “STOP_LOSS” is the problem because the value filled in there should be retrieved from an unrelated table based on a WHERE clause.
It should contain the SL value from another table that does not contain equal fields.
The table is called T_STOP_LOSS and lists intervals.

Table: T_STOP_LOSS

ID   LIVES_FROM LIVES_TO  NR_COUNTRIES_FROM  NR_COUNTRIES_TO  SL_VALUE
1    0          999       2                  2                39,3
12   0          999       3                  3                34,6
23   0          999       4                  4                29,6
34   0          999       5                  9                25,7
45   0          999       10                 100              22,17
46   1000       1499      2                  2                31,1
2    1000       1499      3                  3                27,4
13   1000       1499      4                  4                23,3
24   1000       1499      5                  9                20,4
35   1000       1499      10                 100              17,5

When the values for “Country” and “Employees” (columns 3 & 4, being the results of previous queries) lie in the interval between respectively “LIVES_FROM/LIVES_TO” AND “NR_COUNTRIES_FROM/NR_COUNTRIES_TO”, then what should be returned needs to be the corresponding SL_Value. I can’t figure it out since there are no corresponding fields between the two tables and I’m not allowed to use VBA this time.
To make it harder, “LIVES_FROM/LIVES_TO” and “NR_COUNTRIES_FROM/NR_COUNTRIES_TO” contain the ID of a related table.
Any idea how I can get add this column to the query without using VBA… ?
I attempted to use the Query tool and also SQL view, but I was unable to achieve a proper result (with VBA it would be a lot easier and I am not the most handy one with Access on its own…).

Let me know when my question is not clear!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T00:44:19+00:00Added an answer on June 8, 2026 at 12:44 am

    How about:

    SELECT (SELECT TOP 1 sl_value
            FROM   t_stop_loss t
            WHERE  q.country BETWEEN nr_countries_from AND nr_countries_to
                   AND q.employees BETWEEN lives_from AND lives_to) AS stop_loss,
           q.year,
           q.contr_pool_id,
           q.contr_ins_id,
           q.country,
           q.employees
    FROM   q_stop_loss q 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question regarding my database design and its implementation that i am
This question is related to database/RDBMS where i have little knowledge regarding performance and
I have a question regarding a unified insert query against tables with different data
simple question regarding HQL(Hibernate query language) so i have user class , that can
I have a question regarding updating a MySQL database. I have three tables: Match,
i have a question regarding the efficiency of word press database structure. My intended
I am working on sql server monitoring product and i have database query that
I have a question regarding encodings. In my MySQL database I have encoded users
I think I have read every article and stack overflow question regarding this, but
I have a basic question regarding jQuery. I have a static time-selection box IE:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.