Forum Replies Created

Viewing 15 posts - 1 through 15 (of 36 total)

  • Reply To: Query Help Pivot

    Thanks alot Mark Cowne. I got the output as I requested.

    Once again, Thank you very much.

  • RE: Query help Pivot and Sum

    I tried with below SQL it worked :

    select a.name,max(b.grp1) grp1,max(b.grp2) grp2,max(b.grp3) grp3,max(b.grp4) grp4 from test a

    inner join

    (

    select

    min(name) as name,

    sum(case group_name when 'grp1' then 1 else 0 end) as grp1,

    sum(case group_name...

  • RE: Query help Pivot and Sum

    Suppose I wish to get the name of persons who are in group_name=2 and I got :

    aaa,eee,abc,ccc and ddd.

    Now, aaa person also belongs to grp3 and grp4, so...

  • RE: Query Help

    Hi,

    Thank you for your query. Kindly check is the below sql is correct or not :

    update books set book_cat=1 where book_name='.Net'

    update books set book_cat=2 where book_name='Oracle'

    update books set book_cat=3...

  • RE: Query Help

    What if I forgets about row order too i.e. first I should get category name and then any order of books.

    Regards

    Girish Sharma

  • RE: Query Help

    Hi,

    Thanks for your reply. I am fully agree with you that this is purely design flaw and since he can not do any changes in the table, so it...

  • RE: SQL Help in grouping

    Thank you Chris for your continue support. Probably I am not able to find a bug in the query but when I am saying :

    SELECT *

    FROM #Results

    WHERE...

  • RE: SQL Help in grouping

    Yes, result of your query match with 1st query output. In my original question, I have posted two more required output based upon output of 1st query. I...

  • RE: SQL Help in grouping

    Thanks Chris. This is giving me output of 1st query. Can you please help me how do I get rest 2nd and 3rd query outputs efficiently. Even...

  • RE: SQL Help in grouping

    Hi Chris,

    Thanks for your reply. But I am getting :

    Invalid object name '#students'.

    and what is g.SetSize please?

    Regards

    Girish Sharma

  • RE: SQL Help in grouping

    Yes, now I am able to get 3rd output by using Whole query output Except 2nd query output :

    select

    a.course_id

    ,a.[Course]

    ,a.[Rollno]

    ,a.Description

    ,a.[Geog Marks]

    ,a.[Math Marks]

    from

    (

    select

    course_id

    ,min(course_name) as 'Course'

    ,min(roll_no) as 'Rollno'

    ,case when count(course_id)>1 then...

  • RE: SQL Help in grouping

    I am able to get 1st and 2nd output from below query :

    For 1st output :

    select

    a.course_id

    ,a.[Course]

    ,a.[Rollno]

    ,a.Description

    ,a.[Geog Marks]

    ,a.[Math Marks]

    from

    (

    select

    course_id

    ,min(course_name) as 'Course'

    ,min(roll_no) as 'Rollno'

    ,case when count(course_id)>1 then min('Default') else min(student_name)...

  • RE: Group by based upon condition

    Yes, now no error, no more doubt on this question... only big thanks from mine and my friend side.

    We both learnt good stuff with your and Luis Cazares's great replies.

    Regards

    Girish...

  • RE: Group by based upon condition

    Hi Sean Lange,

    Thanks for correcting me for pronounce the name and I am sorry or my mistake on it. Since, I am an Oracle DBA, and actually this question...

  • RE: Group by based upon condition

    I am really thankful to SSCrazy Eights and You (Ten Centuries). Your query is giving me the correct and required output. Its true that output can be easily...

Viewing 15 posts - 1 through 15 (of 36 total)