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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:36:00+00:00 2026-06-08T17:36:00+00:00

Sorry if the title was misleading or not very descriptive, but here is what

  • 0

Sorry if the title was misleading or not very descriptive, but here is what I want
I have a table with 2 columns :

name|value
1.aaaa|132412
2.aaaa|234124
3.aaaa|542253
bbbb|234324
bbbb|342342

so I want to basically compare the rows where name=”aaaa”
the part where I am stuck is how do I compare all the rows with name=”aaaa”

sql="select value from table where name='aaaa'"
cursor.execute(sql)
result=cursor.fetchall()
for row in result:
  value=row[0]

how do I go about from here ?

edit:
I want to compare value of 1 with 2,1 with 3 and similarly 2 with 3 and so on..

  • 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-08T17:36:01+00:00Added an answer on June 8, 2026 at 5:36 pm

    You’ve figured out the code to get all the results, and then it sounds like you want to compare all the two-item combinations of values.

    sql="select value from table where name='aaaa'"
    cursor.execute(sql)
    results=cursor.fetchall() # changed to results to better reflect the list structure
    count = len(results)
    for i in range(0, count):
      for j in range (i+1, count):
        print results[i][0], results[j][0]
    

    That’ll print all the pairs . . . obviously you’ll want to parse them instead, and do your comparisons where the print statement is.

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

Sidebar

Related Questions

Sorry about the title. I do realize it's not very descriptive. :| Here is
Sorry the title is not very descriptive but it is a tricky problem to
Sorry the title may not be very clear. Basically I have a wrapper for
I am sorry for possible misleading about the title, but I have no idea
Sorry if title is confusing, here is what I want to achieve. I have
Sorry for the title, not easy to phrase it correctly. I have a table
Sorry the title is not very clear. This is a follow up to my
Ok hope that title wasn't misleading I have (among other columns) the following info
Sorry if the title is a little weird... but basically want I want to
Sorry if the title is hard to understand.. :S I have a table with

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.