Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL for grouping records into another table
Message
De
16/01/2002 16:03:23
Jason Dalio
Northern Interior Regional Health Board
Prince George, Colombie Britannique, Canada
 
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00605660
Message ID:
00605690
Vues:
11
Since you have 2 sepearate criterias you are going to ahve to use 2 seperate INSERT statements. Your first statement will consist of an INSERT where the departure date is 1 day greater then the arrival date. The 2nd statement would be INSERT where the departure date is 2 days greater then the arrival date. It's hard for me to write code without knowing your tables but hopefully the example below shows it:

INSERT INTO NewTable SELECT Count(CustomerID) as CountOf1DayAfter FROM OriginalTable WHERE (DepartureDate - ArrivalDate) = 1

INSERT INTO NewTable SELECT Count(CustomerID) as CountOf2DaysAfter FROM OriginalTable WHERE (DepartureDate - ArrivalDate) = 2
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform