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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:26:45+00:00 2026-05-27T17:26:45+00:00

I have 2 tables with columns like this: Table1 testID username topic information totalTime

  • 0

I have 2 tables with columns like this:

Table1
    testID  username    topic   information     totalTime
Table2
    questionID  testID  question    choices     answers

I would like to select all columns for a test with partiular testID from Table1 and #number of questions with same testID from Table2, so the resulting table should be like this:

testID  username    topic   information     totalTime questionCount

testID & questionID are primary keys.

How can I form this query? Thanks.

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

    You can do it like this:

    Select t1.testID, t1.username, t1.topic, t1.information, t1.totalTime, 
       (select count(questionID) from table2 t2 where t2.testID = t1.testID) as 'questionCount'
    from table t1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two very large tables, Table1 and Table2. They look like this: Table1
I have tables like this: Table1 Table2 name1 | link_id name2 | link_id text
I have three tables (these are the relevant columns): Table1 bookingid, person, role Table2
I have a table structure with columns like this [ID] [Name] [ParentId] [ParentName] The
I have a query like this: SELECT TABLE_NAME, COLUMN_NAME, IS_NULLABLE, DATA_TYPE FROM MY_DB.INFORMATION_SCHEMA.COLUMNS WHERE
I have a few tables with 70-80 columns in them. I would like to
I have 3 tables Table1 (with 1020690 records), Table2(with 289425 records), Table 3(with 83692
I have two tables like this: CREATE TABLE table1_lang ( id serial NOT NULL,
If i have a sql table with column like this id version subversion 1
I have very simple select like this: SELECT * FROM table WHERE column1 IN

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.