0

I have a data like this in one column seperated by tilda .

   ~2001-2006  TM1 Escape
   ~2002-2004  350
   ~2005       TF7 F-Series Super Duty
   ~2001-2005  TS1 Explorer Sport Trac
   ~2002-2004  F250
   ~2002-2004  F-Series

the way the requirment is they want to condence this. the output should be liek this

  2001-2006  TM1 Escape
  2005       TF7 F-Series Super Duty
  2001-2005  TS1 Explorer Sport Trac
  2002-2004  F250,F-Series
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786
Awais
  • 67
  • 2
  • 10

1 Answers1

0

If you are using Oracle, replace the ~ with a whitespace using oracle regex function: REGEXP_REPLACE

http://docs.oracle.com/cd/B19306_01/appdev.102/b14251/adfns_regexp.htm

wizoleliam
  • 83
  • 3
  • 13
  • tilda is not the issue. the requirment if the year is the same then use a comma and the model name instead of getting a new row – Awais Feb 24 '14 at 21:32
  • if that's the case, shouldn't the row for 2002-2004 be:350, F250,F-Series? check this out: http://stackoverflow.com/questions/15154644/sql-group-by-to-combine-concat-a-column, I guess it should answer your question – wizoleliam Feb 24 '14 at 21:42
  • yea you are correct . i am havign some weired headache and a flue . so just tyring my best . here – Awais Feb 24 '14 at 21:45