>
>
> Try:
>
> bdteste=# SELECT o1.user_id, o1.order_id, '>= 500' AS cond FROM Orders o1
> bdteste-# WHERE (SELECT sum(o2.amount_paid) FROM Orders o2 WHERE
> o2.user_id = o1.user_id AND o2.order_id > o1.order_id) < 500 AND
> bdteste-#(SELECT sum(o2.amount_paid) FROM Orders o2 WHERE
> o2.us
yes, I am picking up the specific transaction (order_id) so that I can
pickup the create_timestamp and sort it descending.
that will list me those users who did transaction more than 500 in the least
time.
then I can give discount for top 10 users
expected output: user_id, create_timestamp(desc) wi
Devil™ Dhuvader wrote:
its like sum up entries of each user in order table backwards (i.e
from last entry to the first) and find the entry that has sum > $500.
If there is some user who didnt even make 500 till now in my shop return
the first date of transaction/order .
ex:
Orders(order_id,
2008/11/7, Devil™ Dhuvader <[EMAIL PROTECTED]>:
> its like sum up entries of each user in order table backwards (i.e from last
> entry to the first) and find the entry that has sum > $500.
> If there is some user who didnt even make 500 till now in my shop return the
> first date of transaction/ord
its like sum up entries of each user in order table backwards (i.e from last
entry to the first) and find the entry that has sum > $500.
If there is some user who didnt even make 500 till now in my shop return the
first date of transaction/order.
ex:
Orders(order_id, user_id, amount_paid, create_t
I personally would help if I understood what you need. I'm sure others feel
the same way. Provide DDL, sample data, and expected result of the query.
Maybe you'll have better luck...
On Thu, Nov 6, 2008 at 11:15 AM, Devil™ Dhuvader <[EMAIL PROTECTED]>wrote:
> none can help me?
>
> On Tue, Nov 4,
none can help me?
On Tue, Nov 4, 2008 at 9:08 PM, Devil™ Dhuvader <[EMAIL PROTECTED]> wrote:
> hi,
> I need some help in creating a sql.
> the problem is as below.
>
> assume that:
> I am a store keeper
> and I have the list of customer(user_id) transactions in my order table.
> schema: Orders(or
hi,
I need some help in creating a sql.
the problem is as below.
assume that:
I am a store keeper
and I have the list of customer(user_id) transactions in my order table.
schema: Orders(order_id, user_id, amount_paid, create_timestamp)
I want to give discount of 10% for the customer who made orde