>
>
> 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
) with limit 10.
then I will give discount of 10%, 9%, .. etc.
if you know ageing credit. its just like that.
On Sat, Nov 8, 2008 at 2:30 AM, Frank Bax <[EMAIL PROTECTED]> wrote:
> Devil™ Dhuvader wrote:
>
>> its like sum up entries of each user in order table backwards (i.e fro
ote:
> 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]>
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 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
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