Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Select for a Report
Message
De
10/03/2003 09:57:27
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
10/03/2003 09:48:14
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00763620
Message ID:
00763630
Vues:
17
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform