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 6115681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:07:10+00:00 2026-05-23T15:07:10+00:00

Here is a sample data set —————————————————————————————– id nameid name score diff include quantity

  • 0

Here is a sample data set

-----------------------------------------------------------------------------------------
id   nameid   name        score         diff          include     quantity     grade
---------------------------------------------------------------------------------------

7     0002     MO          10            0                0          25          3
8     0002     MO          18            0                1          25          3
9     0002     MO          20            0                0          25          3
10    0002     MO          14            0                0          17          6
11    0002     MO          100           0                0          17          6
11    0002     MO          100           0                0          17          6

12    0003     MA          10            0                0          12          3 
13    0003     MA          18            0                0          12          3
14    0003     MA          20            0                0          12          3
15    0003     MA          14            0                0          25          6
16    0003     MA          100           0                1          25          6
17    0003     MA          100           0                0          25          6

12    0004     MB          10            0                0          12          3
13    0004     MB          18            0                1          12          3
14    0004     MB          20            0                0          12          3 
15    0004     MB          14            0                0          07          6
16    0004     MB          100           0                1          07          6
17    0004     MB          100           0                0          07          6

I have a query that returns the above table.
Note that in each group of six, there WILL be atleast one row that has value 1 in include column.
Look at ref: access query needed but not needed.

Also for each group of six, there are three rows that has grade = 3 and 3 rows that has grade = 6.
And corresspondingly, the grade 3 and grade 6 have the same quantity in that group.

What I want to do is filter out all the rows that have less then 15 quantity.
However, I still want to group them by 6.

I want to remove a “group” that has both quantity < 15 for both grade 3 and 6. From the above data set
I wwant the following result:

-----------------------------------------------------------------------------------------
id   nameid   name        score         diff          include     quantity     grade
---------------------------------------------------------------------------------------

7     0002     MO          10            0                0          25          3
8     0002     MO          18            0                1          25          3
9     0002     MO          20            0                0          25          3
10    0002     MO          14            0                0          17          6
11    0002     MO          100           0                0          17          6
11    0002     MO          100           0                0          17          6

12    0003     MA          10            0                0          12          3 
13    0003     MA          18            0                0          12          3
14    0003     MA          20            0                0          12          3
15    0003     MA          14            0                0          25          6
16    0003     MA          100           0                1          25          6
17    0003     MA          100           0                0          25          6

So basically if a group of six has include = 1 in any row, and either grade 3 or 6 quantity > 15 then I want the entire group.

  • 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-05-23T15:07:11+00:00Added an answer on May 23, 2026 at 3:07 pm

    “So basically if a group of six has include = 1 in any row, and either grade 3 or 6 quantity > 15 then I want the entire group.“

    My guess is this query will identify the candidate nameid groups:

    SELECT DISTINCT nameid
    FROM YourTable
    WHERE
        include = 1
        AND quantity > 15
        AND (grade = 3 OR grade = 6);
    

    If I guessed correctly, you can save it as a separate query, or use it as a subquery, and INNER JOIN it to YourTable to limit the rows returned to only those where nameid meets your criteria. It might look close to this untested SELECT statement:

    SELECT y.id, y.nameid, y.[name], y.score, y.diff, y.include, y.quantity, y.grade
    FROM
        YourTable AS y
        INNER JOIN [
            SELECT DISTINCT nameid
            FROM YourTable
            WHERE
                include = 1
                AND quantity > 15
                AND (grade = 3 OR grade = 6)
            ]. AS q
            ON y.nameid = q.nameid
    ORDER BY y.nameid;
    

    Edit: Add an index on nameid if you don’t already have one.

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

Sidebar

Related Questions

Here is a sample code to retrieve data from a database using the yield
Here is my sample code: from xml.dom.minidom import * def make_xml(): doc = Document()
Here is a sample from Kernighan & Ritchie's The C Programming Language: int getline(char
Here is the sample: Dim TestString As String = Hello, & Chr(0) & World
Here is my sample code. It is meant to be an iterative procedure for
here is some sample javascript: SomeObjectType = function() { } SomeObjectType.prototype = { field1:
I have a result set of data that I want to write to an
Given this data set: SummaryID Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9
I've got a data binding set up with a converter to transform an awkward
I am a novice R user trying to work with a data set of

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.