you may want to group by ID and then take Max of other columns. On Thu, Dec 30, 2010 at 2:12 PM, gayathri Dev <gd0...@gmail.com> wrote:
> Thanks Mike, it works. > > Have a great year ahead. > > > > On Thu, Dec 30, 2010 at 2:03 PM, Michael Moore <michaeljmo...@gmail.com>wrote: > >> not at work, so can't test this but put each col in a max(function) >> >> like: >> max(id), >> max(case when field_name = 'text1' then field_value else null end)column1, >> >> etc ... >> >> Mike >> >> >> >> On Thu, Dec 30, 2010 at 12:35 PM, gayathri Dev <gd0...@gmail.com>wrote: >> >>> how to remove the multiple rows generated by Case statements? >>> >>> For eg: >>> >>> Table : tab >>> case_num, ID, Field_name, Field_value >>> 6, 1, TEXT1 , string1 >>> 6, 1, TEXT2 , string2 >>> 6, 1, TEXT3 , string3 >>> >>> select distinct >>> id, >>> case when field_name = 'TEXT1' then field_value end column1, >>> case when field_name = 'TEXT2' then field_value end column3, >>> case when field_name = 'TEXT3' then field_value end column3, >>> from tab where case_num = 6; >>> >>> Output: (that i am getting) >>> ID, column1, column2, column3 >>> 1, (null), string2, (null) >>> 1, string1, (null), (null) >>> 1, (null), (null), string3 >>> >>> *Expected Output: >>> ID, column1, column2, column3 >>> 1, string1, string2, string3* >>> >>> I want to suppress those row generated for else part of case statement, >>> Please let me know how do we do that? >>> >>> Thanks and happy holidays >>> ~G >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Oracle PL/SQL" group. >>> To post to this group, send email to Oracle-PLSQL@googlegroups.com >>> To unsubscribe from this group, send email to >>> oracle-plsql-unsubscr...@googlegroups.com >>> For more options, visit this group at >>> http://groups.google.com/group/Oracle-PLSQL?hl=en >> >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Oracle PL/SQL" group. >> To post to this group, send email to Oracle-PLSQL@googlegroups.com >> To unsubscribe from this group, send email to >> oracle-plsql-unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/Oracle-PLSQL?hl=en > > > -- > You received this message because you are subscribed to the Google > Groups "Oracle PL/SQL" group. > To post to this group, send email to Oracle-PLSQL@googlegroups.com > To unsubscribe from this group, send email to > oracle-plsql-unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/Oracle-PLSQL?hl=en > -- You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To post to this group, send email to Oracle-PLSQL@googlegroups.com To unsubscribe from this group, send email to oracle-plsql-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Oracle-PLSQL?hl=en