Sto tentando di aggiornare alcuni campi in base alla loro presenza. Se si verificano solo una volta, sto aggiornando alcuni campi di stato.Subquery SQL Server ha restituito più di 1 valore. Ciò non è consentito quando la subquery segue (caratteri) o quando la subquery viene utilizzata come espressione
Il mio codice attuale è la seguente:
UPDATE table1
SET statusField = 1
WHERE someID = (
SELECT someID
FROM table1
GROUP BY someID HAVING COUNT(*) = 1
)
Questo restituisce un errore come quello nel titolo: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
C'è qualche altro, come facilmente leggibile/semplice, soluzione a questo?
Grazie così molto per averlo indicato! Ha funzionato perfettamente questa volta. – NicT
'GRUPPO BY someID HAVING COUNT (*) = 1' non è richiesto qui. –
Fantastico. Grazie! – Rob