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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:39:54+00:00 2026-05-17T15:39:54+00:00

Take a look at the following mySQL query: SELECT fname,lname FROM users WHERE users.id

  • 0

Take a look at the following mySQL query:

SELECT fname,lname FROM users WHERE users.id IN (SELECT sub FROM friends WHERE friends.dom = 1 )

The above query first creates a set of ALL the friends.sub’s via the inner query, and then the outer query selects a list of users where user ids are contained within the set created by the inner query (ie the union of the two sets).

And this works fine. But if you needed the inner set to contain not only the subs where dom = 1, but also the doms where sub = 1, like so:
Outer query remains same as above, pure pseudocode:

(SELECT sub FROM friends WHERE friends.dom = 1 )
***AND***
(SELECT dom FROM friends WHERE friends.sub = 1 )

Is it possible to make this sort of functionality with the inner query??

Any help or assistance appreciated guys;-D

Thanks a lot guys, my headache is gone now!

  • 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-17T15:39:54+00:00Added an answer on May 17, 2026 at 3:39 pm

    Try this:

    SELECT u.fname, u.lname
    FROM users u
    INNER JOIN friends f
      ON (u.id = f.sub AND f.dom = 1)
      OR (u.id = f.dom AND f.sub = 1)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Take a look at the following progression of images: What's happening here is first
Please take a look at the following code: Public Sub Method(Of TEntity As EntityObject)(ByVal
please take a look at the following snippet: public IEnumerable<T> Query(Expression<Func<T, bool>> filter) {
Take a look that the following code snippet: A a = null try {
Please take a look at the following .htaccess ErrorDocument 404 /404/ RewriteEngine On RewriteRule
If you take a look at the following JS: (Live: http://jsfiddle.net/RyanWalters/dE6T3/2/ ) var projects
Could someone take a look at the following link of a work in progress
I need a language lawyer with authoritative sources. Take a look at the following
Please take a look at following code: #include <stdio.h> #include <iostream> using namespace std;
Take a look at the following. The question near the end of the code

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.