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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:37:31+00:00 2026-06-13T21:37:31+00:00

I have two table in my database. 1) User Table id username password logo

  • 0

I have two table in my database.

1) User Table

id  username    password    logo    email
1   admin        admin      NULL    1   
2   support     support     NULL    NULL    
3   test        test        NULL    NULL    


2) Link Account Table

ID  AccountID   LinkAccountID
1       1           2

Now if i select username with accountid 1 then it will return me Admin and Support
same way if i select username with accountid 2 then also it will return admin and support
and if i select username with accountid 3 then it will return only test

something like vice versa if in link account table account id is 1 or linkaccountid is 1 that will return both id

Thanks in advance

Regards

Amit Vyas

  • 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-13T21:37:32+00:00Added an answer on June 13, 2026 at 9:37 pm
    Select u.id,u.Name
    from user u
    left join
    (
    Select AccountID as AID , LinkAccountID as sec from Account
    union
    Select LinkAccountID as AID,AccountID  as sec from Account
    ) a 
    on a.AID=u.ID
    
    where @SearchUser in (Coalesce(a.Aid,u.id),Coalesce(a.Sec,u.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 like User and UserInfo UsersInfo UserId UserName Email Password LastLoginDate
I have two tables in my database: user and media_contact . The media_contact table
Have two separate databases. The master that holds the user information(username, password, address etc.).
Imagine we have two tables in the database, user (FK id_role) and role (PK
Say I have a database called Poll and have these two table structures. poll
I have two columns(column1, column2) in my oracle database table named as demo .
Lets say we have a database table with two columns, entry_time and value. entry_time
I have a database framework where I have two tables. The first table has
In a MySQL database I have two tables linked in a join. One table
I have one database table TABLE_TIPS with two value 1. tips_id (auto increment) 2.

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.