Re: Postgres-sql-php
| От | Oliveiros Cristina |
|---|---|
| Тема | Re: Postgres-sql-php |
| Дата | |
| Msg-id | f54607780810231100v47bbd430h96ddafa7906dad02@mail.gmail.com обсуждение |
| Ответ на | Postgres-sql-php ("Zied Kharrat" <khzied@gmail.com>) |
| Список | pgsql-sql |
I guess you can change a little the query to your needs.
The problem is pretty much the same...
I've used c3 column in equality, but if this column
has repeated values, just choose any column or combination of columns which is unique.
Best,
Oliveiros
SELECT a.c1,a.c2,b.c3,b.c4,a.c5,b.c6
FROM
(
SELECT c1,c2,c5, MIN(c3)as primeiraThe problem is pretty much the same...
I've used c3 column in equality, but if this column
has repeated values, just choose any column or combination of columns which is unique.
Best,
Oliveiros
SELECT a.c1,a.c2,b.c3,b.c4,a.c5,b.c6
FROM
(
FROM t1
GROUP BY c1,c2,c5
) a
RIGHT JOIN t1 b
ON b.c3 = a.primeiraGROUP BY c1,c2,c5
) a
RIGHT JOIN t1 b
AND b.c1 = a.c1
AND a.c2 = b.c2
AND a.c5 = b.c5
2008/10/23 Zied Kharrat <khzied@gmail.com>
Really, i have this schema:
c1 c2 c3 c4 c5 c6
v1 v2 v3 v4 v5 v6
v1 v2 v7 v8 v5 v9
v1 v2 v10 v11 v5 v12
how can i do my sql request to obtain this?
c1 c2 c3 c4 c5 c6
v1 v2 v3 v4 v5 v6
v7 v8 v9
v10 v11 v12
Thank u very much :)
--
even the biggest failure, even the worst mistake, beats the hell out of never trying...
- Meredith Grey
В списке pgsql-sql по дате отправления: