Skip site navigation (1) Skip section navigation (2)

Modifying selected records

From: Ruzsinszky Attila <ruzsinszky(dot)attila(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Modifying selected records
Date: 2009-09-02 08:42:43
Message-ID: f637dd860909020142l7d1dea89s5ac79d200fe500a8@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
Hi,

I've got a subselect which output is this:

sorszam(int);all_kod(varchar);nev(varchar);megall(int);erkezik_ido(time);indul_ido(time);train_selector(varchar)
0;"5510017";"Budapest-Keleti pu.";1;"06:10:00";"06:10:00";"910_365334"
...
21;"5501289";"Győr";1;"07:39:00";"07:39:00";"910_365334"
0;"5501289";"Győr";1;"07:41:00";"07:41:00";"910_311546"
...
5;"5544800";"Csorna";1;"08:00:00";"08:00:00";"910_311546"
0;"5544800";"Csorna";1;"08:12:00";"08:12:00";"910_365339"
...
8;"5502246";"Szombathely";1;"09:02:00";"09:02:00";"910_365339"

I would like this:
...
x;"5501289";"Győr";1;"07:39:00";"07:41:00";"910_xxxxxx"
...
y;"5544800";"Csorna";1;"08:00:00";"08:12:00";"910_yyyyyy"
...

and I'd like recount the sorszam continously from 0 to 34.

Can I do this with SQL or I need PL/pgPerl, for example?

TIA,
Ruzsi

Responses

pgsql-novice by date

Next:From: Oliveiros C,Date: 2009-09-02 09:46:06
Subject: Re: Modifying selected records
Previous:From: Victor JasonDate: 2009-09-02 06:41:14
Subject: Backup aggregate function

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group