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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:52:43+00:00 2026-05-17T16:52:43+00:00

This is probably a really easy question, it’s just very hard to google a

  • 0

This is probably a really easy question, it’s just very hard to google a word like “All”.

SELECT a.Id, Max(b.Number)
FROM Table1 a
JOIN Table2 b
    ON a.FK = b.Id
GROUP BY a.Id

But I want to add a where clause that specifies that all b.Id’s linked to an a.FK must have values. So basically I don’t want to select the a.Id grouping of b.Id’s where any of those b.Id’s are null. Hope I made that clear, let me know if I need to elaborate. Thanks.

Edit – For some clarification (Changed the query above as well):

Table1
Id, FK
1   1
1   2
2   3
3   4
3   5
3   6

Table 2
Id   Number
1    1
2    NULL
3    10
4    20
5    30
6    40

I would want my query to show:

a.Id   Max Number
2      10
3      40

(Notice that a.Id = 1 doesn’t show up because one of the b.Number fields is null)

  • 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-17T16:52:44+00:00Added an answer on May 17, 2026 at 4:52 pm
    select t1.Id, max(Number) as [Max Number]
    from Table1 t1
    left join Table2 t2 ON t1.FK=t2.Id and t2.Number is not null
    group by t1.Id
    having count(distinct t1.FK) = count(distinct t2.Id)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably a really simple question but... I would like to do a
This is probably a really easy question to answer, but for some reason I'm
This is probably a really easy question, but I can't find anything that works.
This is probably a really easy question, I want to access the last element
This is probably a really simple jQuery question, but I couldn't answer it after
This is probably a really stupid newbie-sounding question to you developer type people, but
This is probably a really stupid MSBuild question but if I have <ItemGroup> <Dll
This is probably really easy, but I'm lost on how to make sure it
This is probably a really obvious question, but it's driving me nuts. We have
This is a really easy question, but if I have a bunch of instructions

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.