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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:19:26+00:00 2026-05-31T11:19:26+00:00

I got two tables with the same pk ( idnumber ).. I want to

  • 0

I got two tables with the same pk (idnumber).. I want to select all column from table1 where idnumber (table1’s pk) is equal to idnumber (table2’s pk where table2’s column = “some value”..)

please help… thank you

Here’s what I got so far..

SELECT     
    idnumber, fname, lname, mname, bday, gender, email, contact  
FROM         
    tblStudents   
WHERE     
    (idnumber =  (SELECT idnumber
                  FROM tblPayments
                  WHERE (payment1 = 0)))  

It’s not working…

I’m totally new to SQL Server.. just got started few days ago.. please help..

  • 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-31T11:19:27+00:00Added an answer on May 31, 2026 at 11:19 am

    Assuming both tables share a common column, you can just perform an INNER JOIN and use the WHERE clause to perform additional filtering.

    SELECT * FROM A INNER JOIN B ON A.SharedId = B.SharedId WHERE B.Column1 = 'foo';
    

    SQL Join Fundamentals (2005)

    I think the specific query you are looking for is:

    SELECT 
        S.idnumber,
        S.fname,
        S.lname,
        S.mname,
        S.bday,
        S.gender,
        S.email,
        S.contact
    
    FROM tblStudents S 
        INNER JOIN tblPayments P ON S.idnumber = P.idnumber 
    WHERE P.payment1 = 0;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i've got two tables: members and members_data . They both share the same unique
I've got two tables. Invoice with columns CustomerID, InvoiceDate, Value, InvoiceTypeID (CustomerID and InvoiceDate
I've got two tables: User (id, name, etc) UserRight (user_id, right_id) I want to
I have got a datatable with records from two different database tables. Each of
I got two tables Product(Productname VARCHAR(10), Rating REAL) and Review(RatingID INT, Productname VARCHAR(10), Rating
I got two tables in my database: user and call. User exists of 3
I got two tables, one of which is a helper of the other. The
I've got two tables in my database: Articles and Tags The Tags tables consist
I've got two tables: TableA ------ ID, Name TableB ------ ID, SomeColumn, TableA_ID (FK
I've got two tables that need to be joined via LINQ, but they live

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.