How to use an alias name in the current select

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


--
Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux