pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Broersma Jr <rabroersma@yahoo.com>
To: Phillip Smith <phillips@weatherbeeta.com.au>
To: pgsql-sql@postgresql.org
Subject: Re: SELECT Aggregate
Date: Wed, 28 Jun 2006 22:23:35 -0700 (PDT)
Message-ID: <20060629052335.51714.qmail@web31812.mail.mud.yahoo.com> (raw)
In-Reply-To: <00d001c69b33$bfa13b90$9b0014ac@ITPhil>

> SELECT      trans_no,
>             customer,
>             date_placed,
>             date_complete,
>             date_printed,
>             ord_type,
>             ord_status,
              select (
                         SUM(sell_price)
                         from soh_product
                         where sales_orders.trans_no = soh_product.soh_num
                      ) as transact_sum,
>             customer_reference,
>             salesman,
>             parent_order,
>             child_order,
>             order_number
> FROM        sales_orders
> WHERE       (trans_no Like '8%' AND order_number Like '8%')
>  OR         (trans_no Like '9%' AND order_number Like '8%')
>  OR         (trans_no Like '8%' AND order_number Like '9%')
>  OR         (trans_no Like '9%' AND order_number Like '9%')
>  AND        (warehouse='M')
>  AND        (date_placed > (current_date + ('12 months ago'::interval)))
> ORDER BY trans_no DESC


I am pretty new to SQL.  But while reading a book written by an author recommended on this list,I
can suggest a possible solution that I've seen.  It might work for your problem. Of course, I
haven't tested anything like this and don't know if PostgreSQL supports it.

Just be sure that trans_no is unique in the returned query.

Regards,

Richard Broersma Jr.



view thread (9+ messages)  latest in thread

Message-ID: <20060629052335.51714.qmail@web31812.mail.mud.yahoo.com>
Permalink:  ../20060629052335.51714.qmail@web31812.mail.mud.yahoo.com/
Also on:    postgresql.org/message-id/20060629052335.51714.qmail@web31812.mail.mud.yahoo.com

 · 

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-sql@postgresql.org
  Cc: rabroersma@yahoo.com, phillips@weatherbeeta.com.au
  Subject: Re: SELECT Aggregate
  In-Reply-To: <20060629052335.51714.qmail@web31812.mail.mud.yahoo.com>

* 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