Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL for grouping records into another table
Message
From
16/01/2002 16:03:23
Jason Dalio
Northern Interior Regional Health Board
Prince George, British Columbia, Canada
 
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00605660
Message ID:
00605690
Views:
10
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform