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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:12:26+00:00 2026-05-22T21:12:26+00:00

Table rows I’m using: `factid` int(11) NOT NULL, `segid` int(11) NOT NULL, PRIMARY KEY

  • 0

Table rows I’m using:

`factid` int(11) NOT NULL,
`segid` int(11) NOT NULL,
PRIMARY KEY (`factid`,`segid`)

Here’s the steps of what I’m trying to accomplish:

  • I need the total number of unique segid values in the table.
  • I need a single factid value.
  • This factid value needs to have rows with many unique segid values.
  • ‘Many’ being closest to half the above total unique segid values.

I hope this explains what I’m trying to accomplish. Help appreciated.

  • 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-22T21:12:26+00:00Added an answer on May 22, 2026 at 9:12 pm
    SELECT TOP 1
        facts.factid
      , facts.segids
      , segs.total_segids
    FROM (
        SELECT factid
          , count(distinct segid) as segids
        FROM my_table
        GROUP BY factid
      ) facts,
      (
        SELECT count(distinct segid) as total_segids
        FROM my_table
      ) segs
    ORDER BY abs(facts.segids - (segs.total_segids / 2))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are trying to write a code to mark table rows using html5 local
I'm confused when trying to fetch table rows in mysql using C++ with MySQL
I'm trying to add table rows programmatically following the code here /* Find Tablelayout
I am trying to animate table rows in a UITableView in an iPhone project
I'm trying to collapse or expand table rows with + and - sign displayed
I am using jQuery's toggle() to show/hide table rows. It works fine in FireFox
I'm attempting to use a side navigation to display table rows by category using
I'm using tableDnD to re-order table rows, and then serialize them using $.tableDnD.serialize() I
I'm displaying a table with multiple rows and columns. I'm using a JQUERY plugin
I want to turn my table rows into links using JS. I have it

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.