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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:32:09+00:00 2026-06-11T10:32:09+00:00

Lets say I have a table called ABC in a MS-Access Database. There are

  • 0

Lets say I have a table called ABC in a MS-Access Database.

There are several columns in this table but only two columns are of interest for this question – “Hugo_symbol” and “Start_position”. “Hugo_Symbol” has gene names and several lines can have the same Hugo_symbol – meaning this column has duplicate entries. “Start_position” has numbers – anything from 1000 to 100000000.

I want to build a query that returns lines from table ABC that
1) Have the same Hugo_Symbol AND
2) Start_position is within 20 of each other.

For eg., the query should return,

Hugo_Symbol         Start_Position

TP53                      987654
TP53                      987660
TP53                      987662
APOB                      12345
APOB                      12350
APOB                      12359

because these lines have the same Hugo_Symbol and Start_Position is within 20 of each other.

Is such a query possible? If so, what would the SQL code be?

  • 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-11T10:32:10+00:00Added an answer on June 11, 2026 at 10:32 am

    I don’t use Access, but this is how I’d approach it with ANSI SQL.

    SELECT
      *
    FROM
      ABC    AS first
    INNER JOIN
      ABC    AS second
        ON  second.Hugo_Symbol     = first.Hugo_Symbol
        AND second.Start_Position <= first.Start_Position + 20
        AND second.Start_Position >  first.Start_Position
    

    This will potentially return more data that you expect, and potentially a different format that you expect.

    First.Hugo_Symbol First.Start_Position Second.Hugo_Symbol Second.Start_Position
         TP53              987654                TP53              987660
         TP53              987654                TP53              987662
         TP53              987660                TP53              987662
         APOB              12345                 APOB              12350
         APOB              12350                 APOB              12359
         APOB              12350                 APOB              12359
    

    EDIT:

    The answer above is highly influence with “Each Other”.

    If you reform the requirements as “all records where another record exists with the same symbol and a position with 20 of it’s own position” you could get something like…

    SELECT
      *
    FROM
      ABC     AS data
    WHERE
      EXISTS (SELECT *
                FROM ABC AS lookup
               WHERE lookup.hugo_symbol     = data.hugo_symbol
                 AND lookup.start_position >= data.start_position - 20
                 AND lookup.start_position <= data.start_position + 20
                 AND lookup.start_position <> data.start_position
             )
    

    But Access2000 is more limitted that the databases I normally use. I don’t know what Access2000 can and can’t do.

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

Sidebar

Related Questions

Lets say I have a simple table that only contains two columns: MailingListUser -
Lets say I have one table called REVIEWS This table has Reviews that customers
Lets say I have a table called Gamers. Gamers contains the columns GamerID ,
Lets say I have a database table called Scrape possibly setup like: UserID (int)
lets say I have a table called table1 and it's corresponding columns are col1,
Lets say I have a table in a sql server 2000 database called TransactionType:
Lets say I have a table in MySQL called articles, that has a column
Let's say I have a table called messages with the columns: id | from_id
Lets say I have table with following columns 1. Client - string. 2. Profit
Lets say I have table named Place with columns: placeId int not null auto_increment,

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.