Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fT6qr-0006Ht-Qz for pgsql-sql@arkaria.postgresql.org; Wed, 13 Jun 2018 14:34:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fT6qq-0000UE-DJ for pgsql-sql@arkaria.postgresql.org; Wed, 13 Jun 2018 14:34:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fT6qc-0007RH-Ht for pgsql-sql@lists.postgresql.org; Wed, 13 Jun 2018 14:34:06 +0000 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fT6qY-0008VJ-MQ for pgsql-sql@lists.postgresql.org; Wed, 13 Jun 2018 14:34:05 +0000 Received: by mail-wm0-x230.google.com with SMTP id v16-v6so5109042wmh.5 for ; Wed, 13 Jun 2018 07:34:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:from:to:subject:date:mime-version:thread-index :content-language; bh=aZ1kF/iBmRAAKuXEnR7FYW70VEOuqSeItyL96+h3Nq0=; b=YWhlxs4j7285Sv1NkxYiG5cg0vjU1aWtHPBRfAnGQyI38Qn6uKTUSPYNh1YS9lfuM8 YVbTtBZCvRarZU9UrT2Gxrjwr2hsObNxoPO55yTKqXgucmx3TmVmFl3zGAb/GibJ3/kG +k4L5olaQrzebB6pnCVEUaKuBP2mkOBO982lMyeOotml0Vas2MN6tI1mtURf9J6BYagk M6rmjLPC/iYhwuDuB8fLzwbiEaPOGTliZ5msn6tGSI0ydk0v2OEWMwBkvd2jQqwQVtxB BRifaHd5kDg+Tt4mvjgX0hzqP6NnS3CsNsdL9RPFf1k1eiuzfBUhT3BNg/6thN3PHcxN H1Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:from:to:subject:date:mime-version :thread-index:content-language; bh=aZ1kF/iBmRAAKuXEnR7FYW70VEOuqSeItyL96+h3Nq0=; b=jGsYospKA3u0qfDq6Fs8769UGoOaPOASrh1Xk1/6Uh59XyT+E9EWDWsRG28g5WuLsX s6bj+UYTwiAN+ZPfZMv67jh7px7nnyOWTGBQz7P2HTatihT3dftT7cR8riME4DWH9vUp P0lr53lBUOIC1mbOaRUo47RMs61D7Iypd9Fdr/LFqnxUKiR2zxWMEUo7j4rFZ4HEDMCg 4g0KMuljHswWyZAqzo+/ANhOcXuBxazYXkj/iMbx4xfJBf2ZBnu1YWUGbzNiuiDlgP8M jfe0AjgjJqlPcYD+AWRwG1pwY4Xhkf5zfYsgnPJVrrAVgN5sy+UrtF+SzqVHF09+TjKg 9hhw== X-Gm-Message-State: APt69E1I4FWbBJIjuboG32zQ1oDYportYyKaoDXI2bFxWK+q1R+oqEjL CRxZfuMxfShgrzsHzo/ysdiXkQ== X-Google-Smtp-Source: ADUXVKItTczLEkBp47DxYYGH3bGR3wcFFcJLIEPx+bd6koRyzBZrwTCa2Hf0UwPDUggQJ8XLjY4kOQ== X-Received: by 2002:a1c:5e95:: with SMTP id s143-v6mr3625225wmb.19.1528900440794; Wed, 13 Jun 2018 07:34:00 -0700 (PDT) Received: from PADOUE ([151.80.244.210]) by smtp.gmail.com with ESMTPSA id w15-v6sm5020585wro.52.2018.06.13.07.33.58 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Jun 2018 07:33:59 -0700 (PDT) Message-ID: <5b212b57.1c69fb81.2e3b4.1d26@mx.google.com> X-Google-Original-Message-ID: <006001d40323$8ed046e0$ac70d4a0$@lepretre@gmail.com> From: =?iso-8859-1?Q?Olivier_Lepr=EAtre?= To: Subject: Window ? Date: Wed, 13 Jun 2018 16:33:50 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0061_01D40334.525916E0" X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AdQDI4sgmcOtDRUhT1WuzXuaXOngsQ== Content-Language: fr X-Antivirus: Avast (VPS 180613-2, 13/06/2018), Outbound message X-Antivirus-Status: Clean List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. ------=_NextPart_000_0061_01D40334.525916E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I have a road segment table with a few attributes for each. For each segment, I have a road index and a segment index something like : road seg colA 1 1 att1 1 2 att2 1 3 att3 1 4 att4 2 1 att5 2 2 att6 I want to convert records into lines, 1 att1 att2 att3 att4 2 att5 att6 ... I was considering using window function, with a partition on road but the problem is that segment count is different for each road, up to 30. So it's= seems a bit rough to write something like select nth_value(colA,1), nth_value(colA,2), nth_value(colA,3), nth_value(colA,4)... Of course I can write a script with a loop to insert segments one road afte= r the other, but before going to this, I would appreciate a smarter idea ! Thanks --- L'absence de virus dans ce courrier =E9lectronique a =E9t=E9 v=E9rifi=E9e p= ar le logiciel antivirus Avast. https://www.avast.com/antivirus ------=_NextPart_000_0061_01D40334.525916E0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Hi,

=

 

I ha= ve a road segment table with a few attributes for each. For each segment, I= have a road index and a segment index something like :

 

road=A0=A0=A0 seg=A0=A0=A0=A0 colA

1=A0=A0=A0=A0=A0=A0=A0 1=A0=A0=A0=A0=A0=A0=A0 att1<= /o:p>

1=A0=A0=A0=A0=A0=A0=A0 2=A0=A0= =A0=A0=A0=A0=A0 att2

1=A0= =A0=A0=A0=A0=A0=A0 3=A0=A0=A0=A0=A0=A0=A0 att3

1=A0=A0=A0=A0=A0=A0=A0 4=A0=A0=A0=A0=A0=A0=A0 att4=

2=A0=A0=A0=A0=A0=A0=A0 1=A0=A0= =A0=A0=A0=A0=A0 att5

2=A0= =A0=A0=A0=A0=A0=A0 2=A0=A0=A0=A0=A0=A0=A0 att6

 

= I want to convert records into lines,

 

1=A0=A0= =A0=A0=A0=A0=A0 att1=A0=A0=A0 att2=A0=A0=A0 att3=A0=A0=A0 att4

2=A0=A0=A0=A0=A0=A0=A0 att5=A0=A0=A0 at= t6=A0=A0=A0 ...

 =

I was considering using window = function, with a partition on road but the problem is that segment count is= different for each road, up to 30. So it's seems a bit rough to write some= thing like

 

select nth_value(colA,1), nth_value(= colA,2), nth_value(colA,3), nth_value(colA,4)...

 

Of course I can write a script with a loop to insert segments one road af= ter the other, but before going to this, I would appreciate a smarter idea = !

 <= /p>

Thanks

 

 


3D"" Garant= i sans virus. www.avast.com
=
------=_NextPart_000_0061_01D40334.525916E0--