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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:07:03+00:00 2026-05-30T19:07:03+00:00

I have to make a SQL statement which is taking values from three tables

  • 0

I have to make a SQL statement which is taking values from three tables one table is table with users other with opinion and the third one is table with subject where are four foregin keys- one of the is pointing to opinion record and the rest as separate keys for users record.

How to select a record from this table which containd subject name, opinion value, subject proffesor and subject opinion guy?

  • 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-30T19:07:04+00:00Added an answer on May 30, 2026 at 7:07 pm

    Okay, it’s Saturday night and I’m feeling mellow enough to tackle this without a data model.

    You have given us the names of the three lookup tables (subjects, opinions, users) but not the actual structures and columns. So I’m making some guesses.

    select subjects.name as subject_name
           , opinions.value
           , o_users.name as opinion_guy
           , p_users.name as professor
    from  opinions 
          join subjects on ( opinions.subject_id = subjects.id)
          join users as o_users on ( o_users.id = opinions.opinion_guy_id)
          join users as p_users on ( p_users.id = subjects.professor_id)
    
    /
    

    I realize that this query almost certainly doesn’t fit your schema but it should give you some clues. Otherwise, please give us the table structures, primary and foreign keys, etc.

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

Sidebar

Related Questions

I have to create a table (H2 embedded database) using fields from other tables.
I currently have a prepared statement in Java which uses the following SQL statement
I have a SQL statement similar to the one shown below in Perl: my
I have a table that contains many rows of SQL commands that make up
Suppose I have a myTest.sql scripts, which contains thousands of create table blahblah statements.
I have a sql statement which I would want to ORDER BY a specific
I have a MS SQL view that I want to make available as a
I have created some extra functionality on my Linq-to-SQL classes to make things easier
I have to make a connection to an XMLRPC site from a web application,
I have to make a decision of which database server to use for my

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.