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

  • Home
  • SEARCH
  • 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 6076411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:36:16+00:00 2026-05-23T10:36:16+00:00

I basically have a friend table with two primary columns, uid and fid (user/friend

  • 0

I basically have a friend table with two primary columns, uid and fid (user/friend id’s) and they could go either way, for example a user could befriend somebody and have an entry, although the friend may not have befriended the specific user back and I would like to check for this.

Untested, however I envisioned something like this to work:

  SELECT fid FROM friends WHERE uid = 20  -- check friends of uid 20
AND 
  (SELECT uid FROM friends WHERE fid = 20)) = 0 

I assume it isn’t as easy as this (and if 0 can really check the result or if it is needed), however do you have any suggestions on how to do this without subqueries? Or is this the best “hack” that could be done without two separate queries and result checking code in my server side language?

I would also like to check if they are both friends and whatnot in the future, so I could make use of a better example from here.

  • 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-23T10:36:16+00:00Added an answer on May 23, 2026 at 10:36 am

    look up UNION, UNION ALL, and NOT IN

    these will help you in your set comparisons.

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

Sidebar

Related Questions

I want to have a table with columns: id, user_id1, and user_id2. basically this
Say, I have two tables like these: Table group Table user +----+-----------+ +----+----------+------+----------+ |
Okay so basically : i have this simple example: main.cpp using namespace VHGO::Resource; std::list<BaseTable*>
Basically, I have some nice navigation button .png's given to me from a friend
i have taken over an asp project from a friend and he was basically
I want to have an auto login option check for a user. Basically that
I have a query that retrieves the name of each friend a user has
I have a table with friend1, friend2 and request, basically the end of the
I basically have a page which shows a processing screen which has been flushed
I basically have the following flow: XML -> JSON -> Spring MVC -> jsp

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.