Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL Query

Author  Topic 

sr_aneesh
Starting Member

17 Posts

Posted - 2005-12-17 : 05:12:05
Hi

i am not getting any idea about how to do the following ..

The Basic Purpose is to display List of all customers ,and next 4 or 5 visit Dates against each Customer Name.

Customr Details are from the Customerdetails Table.
Visit Dates are from the Schedule Visit Table.

It should look like the below eg:-

Customer Name Next Four Visit Dates
Customer 1 12/15/2005 12/18/2005 12/21/2005 12/24/2005
Customer 2 12/13/2005 12/16/2005 12/25/2005
Customer 3 12/14/2005 12/20/2005
Customer 4 12/16/2005 12/19/2005 12/26/2005
Customer 5 12/19/2005 12/22/2005
Customer 6 12/6/2005 12/18/2005
Customer 7 12/25/2005 12/26/2005 12/28/2005 12/29/2005




Could u tell me how to get the report in the above format....

i guess u have the Table structure... still this is for ur referenece...

Customer Table

ID Customer1
1 Customer1
2 Customer2
3 Customer3
4 Customer4
5 Customer5
6 Customer6



ScheduleVisit Table
SalesPerson CustomertoVisit VisitDate
25 3 12/15/2005
23 4 12/10/2005
24 2 12/22/2005
26 3 12/22/2005
15 1 12/22/2005
16 3 12/29/2005
25 2 12/25/2005



Thanx
Aneesh

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2005-12-18 : 21:29:29
check out this (obviously you'll need to convert your dates to varchar before building the output string)



--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-12-19 : 00:30:07
Also refer this
http://sqljunkies.com/WebLog/amachanic/archive/2004/11/10/5065.aspx?Pending=true

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2005-12-19 : 00:37:35
hey madhivanan

isn't that the same link I posted?

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page
   

- Advertisement -