Home » SQL & PL/SQL » SQL & PL/SQL » merging row in a query (9i)
merging row in a query [message #425117] Wed, 07 October 2009 11:04 Go to next message
sekharsomu
Messages: 69
Registered: December 2008
Member
i have a table as follows


sno   height  width  length
 1        50  ---      ---
 1        --   6         --
 2        48  ---       --
1         --    --       78
 2         --   56       --
2          --   --       67



NOW, When i run a query i need a merged row output like this(based on a common column here sno):

sno   height  width  length
1      50      6        78
2      48     56        67



How can i do this please guide me
Re: merging row in a query [message #425119 is a reply to message #425117] Wed, 07 October 2009 11:14 Go to previous messageGo to next message
Michel Cadot
Messages: 63810
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Use MAX/GROUP BY.

Post a working Test case: create table and insert statements along with the result you want with these data.

Regards
Michel
Re: merging row in a query [message #425120 is a reply to message #425117] Wed, 07 October 2009 11:15 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
SELECT sno
      ,max(height)
      ,max(width)
      ,max(length)
FROM...
GROUP BY sno
Previous Topic: Need special sort for a nation table
Next Topic: Join issue
Goto Forum:
  


Current Time: Thu Sep 29 15:58:42 CDT 2016

Total time taken to generate the page: 0.20174 seconds