Home > database >  Novice to solve why derived the name error
Novice to solve why derived the name error

Time:09-21

Value first, then the query
Select * from
(select num, student_id FROM score where score. Course_id IN (select course. The cid FROM course where course. The cname='physical')) as A
LEFT the join
(select num, student_id FROM score where score. Course_id IN (select course. The cid FROM course where course. The cname='biological') as W) as B
On B.s tudent_id=A.s tudent_id;

# naming error -- -- -- -- -- - Unknown column 'A.s tudent_id' in 'the field list'

CodePudding user response:

Select * from
(select num, student_id FROM score a where clause a.c ourse_id IN (select cid FROM course b where the biggest name='physical')) as a
LEFT the join
(select num, student_id FROM score a where clause a.c ourse_id IN (select cid FROM course b where the biggest name='biological')) AS b
On B.s tudent_id=A.s tudent_id;

You try this

CodePudding user response:

SELECT * FROM
(SELECT num, student_id FROM score WHERE score. Course_id IN (SELECT course. The cid FROM course WHERE course. The cname='physical')) A
LEFT the JOIN
(SELECT num, student_id FROM score WHERE score. Course_id IN (SELECT course. The cid FROM course WHERE course. The cname='biological'))
BON B.s tudent_id=A.s tudent_id;

CodePudding user response:

Script found in the following two mistakes:
1. Used as A place, A letter is A total solution enter
2. AS B, in parentheses in front of the AS B, already has a AS W
Statements nested a bit more, it is recommended to use the following format:
Select A. *
The FROM score AS A
LEFT the JOIN course AS AC ON A.c ourse_id=AC. Cid
LEFT the JOIN score AS B ON A.s tudent_id=B.s tudent_id
LEFT the JOIN course AS BC ON biggest ourse_id=BC. Cid
WHERE AC. Cname=N 'physical' AND BC. Cname=N 'biological'
  • Related