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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:19:24+00:00 2026-05-19T17:19:24+00:00

Lets say I have a variable ‘userid’, I want to select from aspnet_Membership AND

  • 0

Lets say I have a variable ‘userid’, I want to select from aspnet_Membership AND aspnet_AccountProfile tables. They both have the column userid, I just want to be able to make a statement like SELECT * FROM aspnet_AccountProfile, aspnet_Membership WHERE UserId=@UserId and it gets the records with the matching user id for BOTH tables. how do I do this? Thank you!

  • 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-19T17:19:25+00:00Added an answer on May 19, 2026 at 5:19 pm

    That is called a JOIN:

    There are several basic types of join based on what data exactly you want. These are related to set theory/relational algebra. I’ll list the most common ones:

    INNER JOIN

    Use this when you want to return every possible combination of rows where both tables have a matching UserId. Some rows in either table may not get returned in an inner join.

    SELECT * FROM aspnet_AccountProfile INNER JOIN aspnet_Membership
    ON aspnet_AccountProfile.UserId = aspnet_Membership.UserId
    

    Another way of writing an INNER JOIN (Which I wouldn’t encourage if you want to understand joins) is:

    SELECT * FROM aspnet_AccountProfile, aspnet_Membership
    WHERE aspnet_AccountProfile.UserId = aspnet_membership.UserId
    

    Of course, to select the specific UserId you want, you add a condition on either table eg:

    AND aspnet_AccountProfile.UserId = @UserId

    OR

    AND aspnet_Membership.UserId = @UserId

    Either of those two will work fine for an inner join.

    LEFT OUTER JOIN

    Use this when you want to return all rows from the first table in your query, and every combination where the UserId in the second table matches the first. Some rows in the second table (Membership, in this case) may not get returned at all.

    SELECT * FROM aspnet_AccountProfile LEFT JOIN aspnet_Membership
    ON aspnet_AccountProfile.UserId = aspnet_Membership.UserId
    

    You have to use the left column to narrow down your criteria in this case, or it will automatically get converted to an INNER JOIN.

    WHERE aspnet_AccountProfile.UserId = @UserId

    RIGHT OUTER JOIN

    This is fairly uncommon, because it can usually be written as a LEFT outer join. It’s like a left outer join, but all rows from the second table in the relation are returned instead of the first.

    SELECT * FROM aspnet_AccountProfile RIGHT JOIN aspnet_Membership
    ON aspnet_AccountProfile.UserId = aspnet_Membership.UserId
    

    FULL OUTER JOIN

    Use this if you need to relate all the rows with a matching UserId in AccountProfile to the corresponding rows in Membership, but also need to know which rows in either table don’t have a match in the other one.

    SELECT * FROM aspnet_AccountProfile FULL OUTER JOIN aspnet_Membership
    ON aspnet_AccountProfile.UserId = aspnet_Membership.UserId
    

    Getting results for only a single user is a little trickier in a FULL OUTER JOIN. You have to specify that a NULL or the correct value is okay in either table.

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

Sidebar

Related Questions

I have a variable string text containing lets say ABCDEFGHIJKL. I want to trim
Lets say I have an absolute url /testserver/tools/search.aspx that I store in a variable
I have a variable foo that contains a time, lets say 4pm today, but
Lets say i have a variable that contains the number of search engine names
Lets say I have an int variable n = 8. On most machines this
Lets say I have a variable $var that has not been defined. Why don't
is there a way to slice a string lets say i have this variable
Lets say I have a variable called $file and the for loop: for($i=1; $i
lets say i have this variable : ... Somekindofobject var = new Somekindofobject(); ...
Lets say i have the value 10 assigned to a variable; var values =

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.