SQL Server Performance

Need a solution for this sql query

Discussion in 'SQL Server 2005 General Developer Questions' started by sasivashok, Jan 20, 2011.

  1. sasivashok New Member

    Hi,
    I am using the below query in my sql. Here is four table. I join the table and i show that what output i need.
    Select Reqid,Name,Status,E.ProPName
    from ReqMaster R join ProjMaster P on R.Id=P.id join Systext S on S.sid=P.sid
    join ExtDef D on S.ExtId=E.ExtID
    this returns
    multiple rows for sing req id with different value for property
    like
    Reqid Name Status ProppName
    1 hhhh jjj klkkj
    1 hhhh jjj kjgfff
    1 hhhh jjj nnnnnn
    but i want the result as
    Reqid Name Status PropName1 PropName2 PropName3
    1 hhhh jjj klkkj kjgfff nnnnnn
    Hope awaiting for your's reply guys.
    Regards
    Ashok
  2. RamJaddu Member

  3. sasivashok New Member

    Hi Ram,
    Thanks for your reply. I am using PIVOT table concept already. I am using Oracle 10g. 10g version is not supported PIVOT Table.
    Thats why i think that using sql query through oracle 10g is it possible?
    Thanks
  4. FrankKalis Moderator

    Sorry, but this community is dedicated to SQL Server, not Oracle. [:)]
    You might be better off asking this question in an Oracle community.
  5. satya Moderator

    [:)] true ...dont get confused that you can use similar statements between Oracle & SQL Server tho SQL is universal language for these systems... but with different accent ...
  6. Madhivanan Moderator

    Try the old cross-tab style. Assingn a serial no and reset for each reqid (use row_number() function)
    select col,
    max(case when sno=1 then proppname end) as proppname1,
    max(case when sno=2 then proppname end) as proppname2,
    max(case when sno=3 then proppname end) as proppname3
    from ...
    group by col

Share This Page