Welcome to Sign in | Help
in Search

SELECT

Last post 05-12-2009, 3:28 PM by ungureandavid. 2 replies.
Sort Posts: Previous Next
  •  05-12-2009, 3:06 PM 7142

    SELECT

    Salutare tuturor!

    Poate ma poate ajuta cinva!

    Am nevoie de o interogare mai coplicata. Am o tabela cu urmatoarele campuri:

    id, centrucost, nrbonuri

    Vreau sa aflu suma de nrbonuri pe sectii

    Eu am incercat ceva de genu

    select sum(nrbonuri) from BONURI...ang where centrucost = (select distinct(centrucost) from bonuri...ang)

    si primesc err asta

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

    Cred ca este o eroare la clauza where

    Multumesc
  •  05-12-2009, 3:23 PM 7143 in reply to 7142

    Re: SELECT

    select centrucost, coalesce(sum(nrbonuri),0)
    from BONURI...ang
    group by centrucost

    Acum de ce e gresit ce faceai tu
    (select distinct(centrucost) from bonuri...ang) iti intoarce mai mult de 1 valoare - si nu poate fi egal un scalar(centrucost) cu o tabela ...


    Ignat Andrei
    http://serviciipeweb.ro/iafblog
  •  05-12-2009, 3:28 PM 7144 in reply to 7143

    Re: SELECT

    Multumesc. A functionat
View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems