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

  • Home
  • SEARCH
  • 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 8190943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:47:31+00:00 2026-06-07T03:47:31+00:00

I have a query result set that contains data that I need to filter,

  • 0

I have a query result set that contains data that I need to filter, however, the filtering data is contained within another table and furthermore that filtering table is linked to another table that contains the groupings of filters. Even further the grouping table contains fields that may be null and I need to ignore these fields. I also need to group the results by the groups table. Any idea on the best approach to this problem?

STARTING DATA TABLE

MYID  NAME    ADDRESS        AGE
1     FRED    123 SECOND ST  12
2     JILL    321 FIRST ST   6
3     JOE     54 THIRD ST    4

FILTERING TABLES

--Group: table that is keyed via xref to Set table
GROUP_ID AGEFROM    AGETO    MYID
1        3          7        NULL
2        NULL       NULL     2


--Set: table that is xrefed to group table
SET_ID   NAME
5        SET1
6        SET2

--Xref: table connecting Set and Group
SET_ID    GROUP_ID
5         1
5         2
6         1

DESIRED OUTPUT BY QUERYING THE STARTING DATA TABLE USING THE FILTERING TABLES AS FILTERING CRITERIA

SET     GROUP     NAME    AGE    ID     ADDRESS
5       1         JILL    6      NULL   321 FIRST ST
5       1         JOE     4      NULL   54 THIRD ST
5       2         JILL    NULL   2      321 FIRST ST
6       1         JILL    6      NULL   321 FIRST ST
6       1         JOE     4      NULL   54 THIRD ST

To restate my need:
I need to output the results of the 1st table filtered by the Group Table content and then grouped by the set table taking into consideration possible nulls in the group table as well as ranges of data. Make sense?

What is the best approach to achieve this result?


Thank you for you input. I am a bit confused as to why my request is deemed incomplete and have negative marks on it… I provided the table example containing the data to be filtered, and then the other three tables that contain the filtering data. I even later provided the expected output. I am trying to get some assistance as to a direction to be able to filter/search the database and use the filtering database as the criteria to filter the data to the desired output. I figured there were great SQL folks here that could possible help me. I am a bit confused as to the responses

  • 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-07T03:47:34+00:00Added an answer on June 7, 2026 at 3:47 am

    You need to use some joins, something like this:

    SELECT SetTbl.SetID, GroupTbl.GROUP_ID, ResultsTbl.Name, ResultsTbl.Age, ResultsTbl.Address, GroupTbl.MYID
    FROM ResultsTbl INNER JOIN GroupTbl
            ON (ResultsTbl.MYID = GroupTbl.MYID OR ResultsTbl.AGE BETWEEN GroupTbl.AGEFROM AND GroupTbl.AGETO)
         INNER JOIN SetTbl
            ON GroupTbl.GROUP_ID = SetTbl.GROUP_ID
    

    Your question is not clear so I can’t say for sure this is an answer. Please take the following advices on using stackoverflow:

    • Lose the “Thank you in advance for your assistance!” line, it is nice but doesn’t belong here.
    • You are supposed to try solving the problem and then come to stackoverflow explaining what you have tried and what specific problem you have.

    In general terms, you should review the FAQ and follow its guidelines very seriously. That way stackoverflow will be most useful to you and to others. https://stackoverflow.com/faq

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query that creates a result set like this: Rank Name 1
I have a query that returns a result set similar to the one below:
I have a query that produces a result like this: The data is sorted
I have a table that contains a column that is XML data type. I
I have a set of data that contains full UNC paths to directories. I
I have a stored procedure that contains dynamic sql to return a result set.
I have a table that contains index data, with each row having a start
I have a successful query that currently returns all data except for one table.
I have a java.sql.ResultSet object containg data from a query that was run. How
I have a result of a db query in java.sql.ResultSet that needs to be

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.