From: | JORGE MALDONADO <jorgemal1960(at)gmail(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Select statement with except clause |
Date: | 2013-05-23 18:10:57 |
Message-ID: | CAAY=A79+vsQN3zzPC7CtSoJFPxbp-Kf=yxg-hdCd6AEb3i6P5Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
I have one SELECT statement as follows:
SELECT
lpt_titulo as tmt_titulo,
tmd_nombre as tmt_nombre,
tmd_album as tmt_album,
SUM(lpt_puntos) AS tmt_puntos
FROM listas_pre_titulos
INNER JOIN cat_tit_media ON lpt_titulo = tmd_clave "
WHERE condition
The above statement must have an EXCEPT clause which includes another
SELECT statement almost identical, the difference is in the WHERE condition
and also in one of the fields; "SUM(lpt_puntos) AS tmt_puntos" should be
"SUM(lpt_puntos) * -1 AS tmt_puntos". I only need to convert such a field
to a negative value.
How does the EXCEPT work? Do fields should be identical?
I need the difference to be on the first 3 fields.
Respectfully,
Jorge Maldonado
From | Date | Subject | |
---|---|---|---|
Next Message | David Johnston | 2013-05-23 18:36:30 | Re: Select statement with except clause |
Previous Message | Ian Lawrence Barwick | 2013-05-18 05:28:01 | Re: How to right justify text in psql? |