0

why do I get error:

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

create view viewAss
as select a.kd_ass,m.nama
from mahasiswa m ,asisten a, honor h
where m.NIM = a.nim and a.kd_ass = h.kd_ass
group by a.kd_ass,m.nama,h.honors
having h.honors > (select avg(h.honors) from honor)

Command(s) completed successfully.

but, when I run ..

select * from viewAss

Error :

Msg 512, Level 16, State 1, Line 2 Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

Artem Kulikov
  • 2,250
  • 19
  • 32
rojib
  • 347
  • 1
  • 9
  • 15

1 Answers1

0
create view viewAss
as 
 select a.kd_ass
       ,m.nama
from mahasiswa m 
INNER JOIN  asisten a   ON m.NIM = a.nim
INNER JOIN  honor h     ON a.kd_ass = h.kd_ass
group by a.kd_ass,m.nama,h.honors
having h.honors > avg(h.honors) 
M.Ali
  • 67,945
  • 13
  • 101
  • 127