Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select for a Report
Message
From
10/03/2003 09:57:27
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
10/03/2003 09:48:14
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00763620
Message ID:
00763630
Views:
18
>Hi all,
>
>I would like to create an instruction in SQL to find the balance of products for customers,and then print the result
>
>My table Movements of Stock (MOV_STK) with field
>
cod_mov < = 50 In Stock
>cod_mov > = 50 Out Stock
>
>Some Records
>
>Cod.Mov   Ref.  Date    Customer Quant.
>  05       01   01.01       1      50  -- In
>  55       01   01.01       1      25  -- Out
>  05       02   01.01       1      10
>  55       02   01.01       1       5
>  05       01   02.02       2      10
>  55       01   02.02       2       5
>
>The Report like this
>
>Customer 1
>     Ref 01 Balance 25
>     ref 02 Balance  5
>Customer 2
>     Ref 01 Balance  5, Etc,
>
>
>Thank's
>
>João Batista

select sum(iif(cod_mov <= 50,1,-1)*quantity) as Balance, ...
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform