Welcome to Sign in | Help
in Search

nested select, e posibil?

Last post 07-16-2009, 3:46 PM by noface. 2 replies.
Sort Posts: Previous Next
  •  07-16-2009, 2:17 PM 7398

    nested select, e posibil?

    salut.
    as vrea sa imi spuneti dc exista posibilitatea ca, intr-un sg query, sa fac ceva de genul urmator( ce este intre [[[ si ]]] reprezinta dilema mea,nu stiu forma sub care as putea nest-ui acel select ca parte din selectul principal):


    select
    nrcontract,appid,rezolutie,
    comentarii,
    [[[ SELECT max(c) FROM
    (SELECT dataplata AS c FROM history
    UNION
    SELECT lastphonedate AS c FROM history) as t2 ]]]

    ,max(contactno)+1 as MaxC,lastmodifiedby,lastmodifydate from history
    where nrcontract='1' group by ....
    Filed under:
  •  07-16-2009, 2:51 PM 7399 in reply to 7398

    Re: nested select, e posibil?

    Nu stiu daca inteleg prea bine dar poate vrei ceva de genul:

    SELECT nrcontract,appid,rezolutie, comentarii,
    (
    SELECT max(c)
    FROM (
    SELECT dataplata AS c, nrcontract
    FROM history
    UNION ALL
    SELECT lastphonedate AS c, nrcontract
    FROM history
    ) u
    WHERE h.nrcontract = u.nrcontract
    )as t2,
    max(contactno)+1 as MaxC, lastmodifiedby, lastmodifydate
    FROM history h
    WHERE nrcontract='1'
    GROUP BY nrcontract, appid, rezolutie, comentarii, lastmodifiedby, lastmodifydate

    Te rog sa postezi scriptul de creare pentru tabela si sa explici ce anume doresti sa intoarca selectul. Asa doar am presupus cate ceva .........
    Cătălin D.
  •  07-16-2009, 3:46 PM 7400 in reply to 7399

    Re: nested select, e posibil?

    Multumesc Catalin, a mers impecabil
View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems