Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to refresh group table after participating children?
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Titre:
How to refresh group table after participating children?
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01539940
Message ID:
01539940
Vues:
79
Hi
i have the following tables: for readability i fill it with data so it's easy to understand what's needed
Orders Table
id  date              tourid    pax     ActivityID
1   01/04/2012      1          2           1
2   01/04/2012      2          1           2
3   01/04/2012      1          1           1
4   02/04/2012      1          1           3
Then i would like to maintain an Activity table, which is the Orders table grouped by Date and TourID as in:
Activity table:
ActivityID    Date           tourid     TotalOrders    TotalPax
    1          01/04/2012      1                3              4
    2          01/04/2012      2                1              1
    3          02/04/2012      1                1              1
I would like a stored procedure to do the following: when adding a new Order, either create a new activityID line, or update the quantities if there already is one. When modifying an order, modify the resuting ActivityiD accordingly. Finally, i would like to save the related ActivityID in the orders table.

Thanks
Jaime
Why do programs stop working correctly as soon as you leave the Fox?
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform