Код: Выделить всё
SELECT
HospitalName,
Invoice,
RegDate,
(SELECT ROUND(SUM(Price) * Coefficient2, 2) FROM RegisterRow WHERE RegisterDocID_Ref = RegisterDocID) AS Amount,
HelpTypeName,
Act,
WorkerName
FROM RegisterDoc
JOIN Hospital ON HospitalID = HospitalID_Ref
JOIN HelpType ON HelpTypeID = HelpTypeID_Ref
JOIN Worker ON WorkerID = WorkerID_Ref
WHERE RegisterDocID = @RegisterDocID