It looks like you would likely be able to merge the queries together quite easily as many are using common tables, but without a table structure I am just writing a quick and dirty mashup or the three queries you have provided. I am assuming that each of these queries retuns exactly what you need and nothing else.
I have altered the third query just so slightly to add in the studentID so that it can be properly joined with the other queries and also commented out redundant information in the d">second query.
select
a.studentID as studentID,
a.studentName as studentName,
$cid as courseID,
a.batchID as batchID,
a.subjectID as subjectID,
c.subjectName as subjectName,
a.unitID as unitID,
b.assignmentID as assignmentID,
b.assignmentName as assignmentName,
b.assignmentMappingID as assignmentMappingID,
c.marksScored as marksScored,
c.maxMarks as maxMarks,
c.percentage as percentageMarks
from
(
select
distinct(syllabus.syllabusName) as subjectName,
$cid as courseID,
stud.batchId as batchID,
course.courseID,
course.syllabusId as subjectID,
course.unitID,
stud.studentID as studentID ,
concat(stud.studentFirstName,' ',stud.studentLastName,' ',stud.studentRegistrationNumber) AS studentName
FROM
studentdetails stud
INNER JOIN `coursemapping` course
ON stud.`courseId`=course.courseId
INNER JOIN syllabus syllabus
ON course.syllabusId=syllabus.syllabusId
WHERE
course.courseId ='$cid'
AND course.syllabusId='$sid'
AND stud.`batchId`='$bid'
) a,
(
SELECT
A.assignmentID,
A.unitID,
B.assignmentName,
C.assignmentsBatchId AS batchID,
C.courseId AS courseID,
C.assignmentMappingID,
D.studentID,
--concat( E.studentFirstName, ' ', E.studentLastName, ' ', E.studentRegistrationNumber ) AS studentName
FROM
studentdetails E
INNER JOIN assignmentscompleted D
ON E.studentId = D.studentId
INNER JOIN assignmentsbatch C
ON D.assignmentId = C.
manpreet
Best Answer
2 years ago
FIRST QUERY
SECOND QUERY
THIRD QUERY
Here i com/tag/need">need to join all the three query in der">order to fetch the subject,student,accmarks,marks,percentage? how to join all this three query to single query