pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Guy Deleeuw <G.De_Leeuw@eurofer.be>
To: pgsql-admin@postgresql.org
Subject: How to use an alias name in the current select
Date: Wed, 24 Mar 2010 17:42:10 +0100
Message-ID: <4BAA40E2.3000805@eurofer.be> (raw)

Hello

I have :
    SELECT
          t_orders_articles.k_id            AS k_id
         ,t_orders_articles.quantity        AS order_qty
         ,(SELECT sum(quantity) FROM t_deliveries_articles WHERE 
article_id = t_orders_articles.k_id) AS delivery_qty
         , (t_orders_articles.quantity - delivery_qty)       AS qty
       FROM t_orders_articles
        ......;

But it's not working I receive the error :
ERROR : The column delivery_qty does not exist.

How can I make that without having 2 select call ?

Regards
Guy




view thread (3+ messages)  latest in thread

Message-ID: <4BAA40E2.3000805@eurofer.be>
Permalink:  ../4BAA40E2.3000805@eurofer.be/
Also on:    postgresql.org/message-id/4BAA40E2.3000805@eurofer.be

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: G.De_Leeuw@eurofer.be
  Subject: Re: How to use an alias name in the current select
  In-Reply-To: <4BAA40E2.3000805@eurofer.be>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox