sql - Concatenate values in one column depending on other column s value -


i need concatenate col2 values depending on col1 value. table looks below:

col1    col2 ---------------- 1       10520.72 1       10520.71 2       10520.81 2       10520.82 3       10520.91 3       10520.92 

i need query displays below:

col1   col2 ------------------------- 1       10520.71-10520.72 2       10520.81-10520.82 3       10520.91-10520.92 

i work toad, wm_concat, group_concat, array_to_string won't work me.

please let me know how it.

reena

this might work you

select col1, cast(min(col2) varchar)+'-'+cast(max(col2) varchar) col2 t_table group col1 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -