Re: Postgres-sql-php - Mailing list pgsql-sql

From Oliveiros Cristina
Subject Re: Postgres-sql-php
Date
Msg-id f54607780810231100v47bbd430h96ddafa7906dad02@mail.gmail.com
Whole thread Raw
In response to Postgres-sql-php  ("Zied Kharrat" <khzied@gmail.com>)
List pgsql-sql
<br /><font face="Courier New" size="2"><div class="Ih2E3d">I guess you can change a little the query to your needs.<br
/>Theproblem is pretty much the same...<br />I've used c3 column in equality, but if this column<br />has repeated
values,just choose any column or combination of columns which is unique.<br /><br />Best,<br />Oliveiros<br /><br
/>SELECTa.<font color="#ff0000">c1</font><span style="color: rgb(255, 102, 102);"></span>,a.<span style="color:
rgb(255,0, 0);">c2</span>,b.<span style="color: rgb(255, 102, 102);">c3</span>,b.c4,<font
color="#ff0000">a.c5,</font><fontcolor="#000000">b.c6</font><br /> FROM<br />(<br /></div>SELECT c1,c2,c5, MIN(c3)as
primeira<divclass="Ih2E3d">FROM t1<br />GROUP BY c1,c2,c5<br />) a<br />RIGHT JOIN t1 b<br /></div>ON b.c3 =
a.primeira<br/>AND b.c1 = a.c1<br />AND a.c2 = b.c2<br />AND a.c5 = b.c5<br /></font><br /><div
class="gmail_quote">2008/10/23Zied Kharrat <span dir="ltr"><<a
href="mailto:khzied@gmail.com">khzied@gmail.com</a>></span><br/><blockquote class="gmail_quote" style="border-left:
1pxsolid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div dir="ltr">Really, i have this
schema:<br/><br /><u>c1     c2     c3      c4     c5      c6</u><br /><b>v1</b>     <b>v2</b>     v3      v4    
<b>v5</b>     v6<br /><b>v1</b>     <b>v2</b>     v7      v8     <b>v5</b>      v9<br /><b>v1</b>     <b>v2</b>    
v10   v11    <b>v5</b>      v12<br /><br />how can i do my sql request to obtain this?<br /><br /><u>c1     c2     c3  
  c4     c5      c6</u><br /><b>v1</b>     <b>v2</b>     v3      v4     <b>v5</b>      v6<br /><b>            </b>    
v7     v8     <b>    </b>      v9<br /><b>             </b>     v10    v11    <b>   </b>      v12<br /><br /><br
/>Thanku very much :)<br /></div></blockquote></div><br /><br clear="all" /><br />-- <br />even the biggest failure,
eventhe worst mistake, beats the hell out of never trying...<br />- Meredith Grey<br /><br /> 

pgsql-sql by date:

Previous
From: Steve Midgley
Date:
Subject: Re: grouping/clustering query
Next
From: Joe
Date:
Subject: Re: grouping/clustering query