Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Select with Join group
Message
De
06/06/2019 13:43:10
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01668934
Message ID:
01668938
Vues:
36
J'aime (1)
Hi Dmitry,

this is called a "join select". For example, https://stackoverflow.com/questions/51750160/select-from-table-join-select-in-visual-foxpro

enjoy,

Hank

>Hi,
>
>How I would create a SQL Select for the following case:
>Table 1
>
>PART_NO   PART_PK    PART_QTY
>"123"          1                 34
>"ABC"         2                 0
>"NBZ"         3                 12
>
>
>Table 2
>
>PART_PK       QTY
>1                    3
>1                    4
>1                    10
>3                     1
>2                     6
>3                     2
>2                     35
>
>
>Resulting query should be
>
>PART_NO         PART_QTY      ACT_QTY   (Act Qty is SUM of QTY in Table 2 field QTY)
>"123"                34                   17
>"ABC"               0                      41
>"NBZ"              12                     3
>
>
>TIA
>
>UPDATE: I know that the SQL Select should consist of two SQL Select:
>
>select PART_NO, PART_QTY ..... (SELECT SUM(QTY) AS ACT_QTY from Table2 GROUP BY PART_PK) AS ACT_QTY FROM Table1
>
>
>But I don't know how to "connect" the main SQL Select with the SUB-SQL Select
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform