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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:15:09+00:00 2026-06-08T06:15:09+00:00

I have to find a result based on the following tables Students StudentPapersSelection as

  • 0

I have to find a result based on the following tables

Students
StudentPapersSelection as sps
StudentGroupManagegemt as sgm
Internal Data as iars

From student I need students rollno and name where iars’s paperid = sps’s paperid and iars groupid= sgm group id and students id should be based on the previous two things.

The query I am running is:

select students.rollno, students.name 
from students,sps,iars,sgm 
where iars.id=1
and students.studentid=(select studentid 
                        from sps where sps.paperid=iars.paperid
                        and iars.id=1)
and students.studentid=(select studentid 
                        from sgm 
                        where sgm.groupid=iars.groupid 
                        and iars.id=1) 
and students.course=iars.courseid  
and students.semester=iars.semester

It says query returning more than 1 rows. I hate this problem.

  • 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-08T06:15:12+00:00Added an answer on June 8, 2026 at 6:15 am

    I’ll try I guess:

    select  students.rollno,
            students.name
    from    iars, students join sps on students.studentid = sps.studentid
            join sgm on students.studentid = sgm.studentid
    where   iars.id = 1 
    and     sps.paperid=iars.paperid
    and     sgm.groupid=iars.groupid
    and     students.course = iars.courseid
    and     students.semester = iars.semester
    

    Assuming tables like this:

    CREATE TABLE `students` (
      `studentid` int(11) NOT NULL AUTO_INCREMENT,
      `rollno` int(11) DEFAULT NULL,
      `name` varchar(255) DEFAULT NULL,
      `course` int(11) DEFAULT NULL,
      `semester` int(11) DEFAULT NULL,
      PRIMARY KEY (`studentid`)
    ) ENGINE=InnoDB AUTO_INCREMENT=66820 DEFAULT CHARSET=latin1
    
    
    CREATE TABLE `sps` (
      `studentid` int(11) NOT NULL AUTO_INCREMENT,
      `paperid` int(11) DEFAULT NULL,
      PRIMARY KEY (`studentid`)
    ) ENGINE=InnoDB AUTO_INCREMENT=66820 DEFAULT CHARSET=latin1
    
    
    CREATE TABLE `sgm` (
      `studentid` int(11) NOT NULL AUTO_INCREMENT,
      `groupid` int(11) DEFAULT NULL,
      PRIMARY KEY (`studentid`)
    ) ENGINE=InnoDB AUTO_INCREMENT=66820 DEFAULT CHARSET=latin1
    
    
    CREATE TABLE `iars` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `paperid` int(11) DEFAULT NULL,
      `groupid` int(11) DEFAULT NULL,
      `courseid` int(11) DEFAULT NULL,
      `semester` int(11) DEFAULT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=66820 DEFAULT CHARSET=latin1
    

    And data like this:

    insert into students values (1,1,'a',1,1);
    insert into students values (2,1,'b',1,1);
    insert into iars values(1,1,1,1,1);
    insert into sgm values (1,1);
    insert into sps values (1,1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written the following code snippet to read data from the database :
I have a Find function in order to find an element from a BST
I have to find some patters from a XML file, but i am unable
I'm having the following problem with 2 MySQL tables that have a relation: I
I have the following tables Actions: actionID, time, type States: stateID, time, type I
Say I have a regular expression like the following, but I loaded it from
SQL Server 2005+. I have a table with the following schema/data: Name Slots Date
I have two tables one with cities and one with pois. I want find
Say I have a query which returns the following result: | val | type
I have the following submit handler which should lookup for some value based on

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.