Ben bu hata varBirleştirme sorgusu içinde alt sorgu nasıl yazılır?
SELECT Op.MRNO,
M.PatientName,
(
SELECT COUNT(MRNO) AS Visit
FROM HMS_Reg_OPRegister
GROUP BY MRNO
)
FROM HMS_Reg_Patient M,
HMS_Reg_OPRegister Op
WHERE Op.MRNO = M.MRNO
altına sorgu yazarken:
SELECT M.MRNO,
MAX(M.PatientName) AS PatientName,
COUNT(*) AS Visit
FROM HMS_Reg_Patient M
JOIN HMS_Reg_OPRegister Op ON Op.MRNO = M.MRNO
GROUP BY M.MRNO
Bir kullanmak zorunlu değildir: İstediğiniz sanki
Msg 512, Level 16, State 1, Line 14 Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <=, >= or when the subquery is used as an expression.
Ne yapmaya çalışıyorsun, İstediğiniz çıktı nedir? Bize tablo yapılarını verir misin? – Ramkee
Sorunuzla doğrudan ilgili olmasa bile muhtemelen bu makaleye göz atmalısınız. http://sqlblog.com/blogs/aaron_bertrand/archive/2009/10/08/bad-habits-to-kick-using-old-style-joins.aspx –