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
Post a Comment