Removing Last field from CSV string - Mailing list pgsql-general

From Alex Magnum
Subject Removing Last field from CSV string
Date
Msg-id CA+cR4ze=Qq9V1i4NGNjCP_=O0bduM8KVse1oCVeszsR8LmVyzA@mail.gmail.com
Whole thread Raw
Responses Re: Removing Last field from CSV string  (Michael Nolan <htfoot@gmail.com>)
Re: Removing Last field from CSV string  (Christian Ramseyer <rc@networkz.ch>)
Re: Removing Last field from CSV string  (Steve Litt <slitt@troubleshooters.com>)
Re: Removing Last field from CSV string  (Samuel Roseman <muelrose@yahoo.com>)
List pgsql-general
Hi,

I have a string that I want to cut to 60 char and then remove the last field and comma.

substring('Class V,Class VI,Class VII,Competitive Exam,Class VIII,Class X,Class XI,Class IX,Class XII',1,60);

substring | Class V,Class VI,Class VII,Competitive Exam,Class VIII,Class

Now I try to remove the last  field and comma  ",Class"

To get  Class V,Class VI,Class VII,Competitive Exam,Class VIII

Is there a function or easy way to do this?
Any help would be appreciated.

Thank you
Alex

pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: schema agnostic functions in language sql
Next
From: Rob Sargent
Date:
Subject: Re: schema agnostic functions in language sql