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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:32:46+00:00 2026-06-07T10:32:46+00:00

I have two tables: First: id | title 1 | aaa 2 | bbb

  • 0

I have two tables:

First:
id | title 
1  | aaa
2  | bbb
3  | ccc

Second:
id | first_id | one | two | three | four
1  |    1     | 3   | 1   | 4     | 6
2  |    2     | 4   | 4   | 1     | 2
3  |    3     | 1   | 2   | 3     | 4

and i would like show:

id | title | min | max 
1  | aaa   |  1  | 6
2  | bbb   |  1  | 4
3  | ccc   |  1  | 4

Is this possible with SQL? How? 🙂

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

    Read Tom’s answer, this would be the best to do.

    Anyway, and shame on me :

    SELECT f.id, f.title
     MIN(LEAST(s.one, s.two, s.three, s.four)) as min,
     MAX(GREATEST(s.one, s.two, s.three, s.four)) as max
     FROM First f
     INNER JOIN Second s on f.id = s.first_id
     GROUP BY f.id, f.title
    

    you can remove MIN and MAX (and Group by) if Second can’t have many rows with same first_id.

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

Sidebar

Related Questions

I have two tables which i would like to turn into one in a
i have two data tables with the same structure the first one has one
I have two tables like this: [tblFacilityHrs] id uid title description [tblFacilityHrsDateTimes] id owner_uid
I have two tables, first table structure (data) : -id -name -title -mail -source_id
I have two tables. First table looks like this: Table: Records rid | user
I have two tables in my application. The first one, Sections, stores content for
I have two tables: author (id, first_name, last_name) books (id, title, rate, author_id) and
In my dbsql file, I have two CREATE TABLES the first works and the
I have two tables. The first table has a column with a lot of
I have two tables, the first has a primary key that is an identity,

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.