Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Select for a Report
Message
 
 
À
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:
00763628
Vues:
19
SELECT Customer, ref, ;
    SUM(IIF( cod_mov <= 50, Quantity, 0)) AS Qin, ;
    SUM(IIF( cod_mov > 50, Quantity, 0)) AS Qout, ;
  FROM Movements ;
  GROUP BY 1,2
BTW, 50 cannot belong to both In and Out.

>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
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform