All Forums Database
07 Jan 2008
Need to convert columns into a row

application_id epx eqi tu1234 0.0 ? ?1234 ? 5.0 ?1234 ? ? 4.0I need to convert above data into a single row like:application_id epx's value eqi's value tu's valueplease tell how to implement it??

07 Jan 2008

Manish Shekharif each row only has one value populated at any given time (other values are NULL)then you can just group by the application_id and sum the other fieldsapplication_id epx eqi tu1234 0.0 ? ?1234 ? 5.0 ?1234 ? ? 4.0select application_id, sum(epx) as epx_val, sum(eqi) as equ_val, sum(tu) as tu_valfrom tableAgroup by 1;Hope that is what you want.

pabolu 1 post Joined 03/08
09 Mar 2008

But what if all the 3 columns (apart from PI) have values and let us say if the o/p should have one row only with the values concatenated.Table structure:A xxx 1234 abcA yyy 4567 dfA zzZ 3456 gO/P should be:A "xxx, yyyy, zzzz" "1234, 4567, 3456" "abc, df, g"Thanks,Srini

You must sign in to leave a comment.