Viewing 15 posts - 16 through 30 (of 83 total)
Hi,
My original question was along the lines of I have a table that has three columns
Table Sales (HHArea, WeekEnding, SalesAmount)
There are 6 area's with 52 weeks of sales for...
August 8, 2016 at 12:57 pm
Hi Jacob ,
Tried it out and its nearly there.
Here the test data I've been using
INSERT INTO [TblClientPOCV2]
([ClientID],[StartDate],[ApptTime],[Duration],[Frequency],[EndDate],[StaffID])
VALUES
(2528,'04/01/2016','09:00',20,1,'29/01/2016', 123),
(2528,'04/01/2016','10:00',30,2,'29/01/2016', 123),
(1111,'04/01/2016','10:00',35,3,'29/01/2016', 123),
(2528,'10/01/2106','17:00',15,2,'31/01/2106', 123),
It correctly processes the first three row, but...
January 12, 2016 at 2:10 pm
Hi Jacob, you are correct in your thinking.
The output from your sample data would be...
222, '2016-01-07','13:00',30,222
222, '2016-01-14','13:00',30,222
222, '2016-01-21','13:00',30,222
222, '2016-01-29','13:00',30,222
222, '2016-01-08','13:00',30,222
222, '2016-01-22','13:00',30,222
Also max days between dates will be 28.
Hope this...
January 12, 2016 at 12:31 pm
Hi Jacob, thanks for your interest, I did leave out the PK on my initial table definitions to try tokeep it as simple looking as possible.
One more correction ClientID should...
January 11, 2016 at 6:02 pm
Hi Guys, thank you so muchagain.
Apologies to Lynn I thought all ms sql server databases had default dates as 'yyyy-mm-dd', also I should have mentioned there are only 2...
January 9, 2016 at 7:21 am
Thanks guys looks good..
Tried and appears to Work Brilliant !!!!:-D:-D:-D:-D
January 8, 2016 at 12:32 pm
HI,
Here is the new test data in the correct format.
INSERT INTO [TblAppointments]
([ClientID],[ApptDate],[ApptTime],[StaffID],[Duration])
VALUES
(2528,'10/01/2016','10:00',22011063, 30),
(2528,'11/01/2016','10:00',22011063, 30),
(2528,'12/01/2016','10:00',22011063, 30),
(2528,'13/01/2016','10:00',22011063, 30),
(2528,'14/01/2016','10:00',22011063, 30),
(2528,'15/01/2016','10:00',22011063, 30),
(2528,'16/01/2016','10:00',22011063, 30),
(2528,'17/01/2016','10:00',22011063, 30),
(2528,'10/01/2016','15:00',22011063, 45),
(2528,'12/01/2016','15:00',22011063, 45),
(2528,'13/01/2016','15:00',22011063, 45),
(2528,'14/01/2016','15:00',22011063, 45),
(2528,'15/01/2016','15:00',22011063, 45),
(2528,'16/01/2016','15:00',22011063, 45),
(2528,'17/01/2016','15:00',22011063, 45),
(2528,'10/01/2016','10:00',22016486, 30),
(2528,'11/01/2016','10:00',22016486, 30),
(2528,'12/01/2016','10:00',22016486, 30),
(2528,'13/01/2016','10:00',22016486,...
January 8, 2016 at 2:53 am
Hi Folks;
Jeffs code ran brilliantly until changed my test data and added two appointment rows for the same client with same date and times data but with different StaffID's.
The result...
January 7, 2016 at 9:51 am
Hi Hugo,
Your right, but every row from the source table could and will have different dates , therefor I need to use a cursor to iterate over them! Which...
January 7, 2016 at 7:28 am
Hi, Sean solution is correct but I have failed to make it clear what I am looking for. Its the old adage "Thats what I asked for, but its not...
January 7, 2016 at 3:57 am
Yes Sean, my bad the test data dates should have been...
INSERT INTO [TblClientPOCV2]([ClientID],[StartDate],[ApptTime],[Duration],[Frequency],[EndDate],[StaffID]
VALUES
(2528,'2015-12-28','10:00',30,1,'2016-01-24',2200176)
(2528,'2015-12-28','15:00',45,1,'2016-01-24',2200176)
Each 28 days apart.
Hi Sean, Thank you for your solutions looks great will test later and let you...
January 7, 2016 at 3:21 am
Hi, Yes in this case Frequency is 1 which means a date for every date between the two dates and the number of new rows inserted into TblAppointment should be...
January 6, 2016 at 2:52 pm
Here is my View VwAppointments1 joining TblAppointments to TblStaff.
SELECT dbo.TblAppointments.ClientID, dbo.TblAppointments.ApptDate, dbo.TblAppointments.ApptTime,
...
January 6, 2016 at 9:58 am
Hi Jeff,
Well I initially wanted to get the problem as simple as possible until 'we' got the code working, which you did.
Thats why my Appointments table had only 5 fields...
January 5, 2016 at 5:19 pm
Hi,
Just ran Jeff's code! Worked Brilliantly...Genius....Thank you so much! :-):-):-):-)
Also I should have added that ClientID, ApptDate, ApptTime, StaffID are a unique index, therefor no 2 staff will be on...
January 5, 2016 at 5:30 am
Viewing 15 posts - 16 through 30 (of 83 total)