Subject | Re: [firebird-support] Little complicated SQL request from guru |
---|---|
Author | Martijn Tonies |
Post date | 2007-05-28T10:52:35Z |
> I have two tables:Care to tell how you are deriving the values in your supposed result?
>
> Customers (id, name)
> History (cust_id, descript, in_money, out_money)
>
> Here is a sample data:
>
> Customers:
> 1 Cust_Name1
> 2 Cust_Name2
> 3 Cust_Name3
>
> History
> 1 Order No 01 0.00 100.00
> 1 Order No 02 0.00 150.00
> 1 Order No 03 0.00 180.00
> 2 Order No 04 0.00 200.00
> 2 Order No 05 0.00 250.00
> 2 BankReport 1 200.00 0.00
> 1 BankReport 2 150.00 0.00
>
> and I need SQL statement to get all order documents that are not
> complet payed.
>
> Cust_Name1 Order No 02 150.00 50.00
> Cust_Name1 Order No 03 180.00 180.00
> Cust_Name2 Order No 05 250.00 250.00
>
> Last column is value which is represen the unclosed order by payment!
>
> If I wasn't complicated in my description that is my SQL problem!
How do you get these values?
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com